UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:14:37";
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-14 04:27:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 07:57:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-14 07:57:18', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=4112
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-14',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-14 04:27:25";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-14 07:57:25', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=4113
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:48:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:18:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 08:18:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4114
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:49:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:19:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-14 08:19:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4115
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:49:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:19:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-14 08:19:34', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4116
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '270';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('270', '1', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2', '1', '1', '2026-10-14','0','0'); -- id=4219
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1814', '1814', '2026-10-14', '1', '0', '0', '2026-10-14 08:19:35','اعادة جرد للمنتج : (لفه سلك ترمو 2 ملي الفرنسيه /اسلاك) فى مخزن : (المخزن الرئيسي) بالكمية : 1','1','0',null,'0','4219','inventoryController.php?do=details&id=4219'); -- id=1570
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1570', '188', '1814', '','0'); -- id=1582
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-63379.4', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1570', '382', '1814', '','0'); -- id=1573
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2358247.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';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:49:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:19:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-14 08:19:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4117
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 04:50:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:20:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-14 08:20:04', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4118
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '64.5', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '9.5', '74', '1', '2026-10-14','0','0'); -- id=4220
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1483.5', '1483.5', '2026-10-14', '1', '0', '0', '2026-10-14 08:20:05','اعادة جرد للمنتج : (متر سلك ترمو 2 ملي المصريه/اخري) فى مخزن : (المخزن الرئيسي) بالكمية : 74','1','0',null,'0','4220','inventoryController.php?do=details&id=4220'); -- id=1571
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1571', '382', '1483.5', '','0'); -- id=1583
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2359731.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 ('1571', '188', '1483.5', '','0'); -- id=1574
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-64862.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-14 04:50:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 08:20:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 08:20:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4119
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 07:38:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 11:08:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 11:08:04', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4120
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 07:53:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 11:23:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 11:23:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4121
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 07:57:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 11:27:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 11:27:31', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4122

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf4a17e3a36
-- ----------------------------------------------------------------------------------------------------

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-14 11:27:31', '06acf4a17e3a36', '1', '0.00', '0', '0', '1', '2435.00', '2435', '2435', '0', '1', '2026-10-14 11:27:31', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '151' ,'0','','','','','-1','0','0','0','0','0','2435','0','','0','0','2435','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=287
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','اضافة فاتورة مبيعات','287', '0', '2026-10-14 11:27:32', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2435', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 11:27:31','0','0','',''); -- id=486
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16','00239', '287', '2', '239', '100', '18', '1800', '0', '', '1', '2026-10-14 11:27:32', '239', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','18','1800','0','','0','0.00','0','0','0','0'); -- id=2299
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 2299;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (239, '2026-10-14', 1800, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, 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+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-14', 1800, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, 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 = '55', userid = '1', storedetaildate = '2026-10-14 11:27:32' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '100', '1', '287', 'اضافة فاتورة مبيعات', 'sellbillController.php', '155', '55', '1', '2026-10-14 11:27:32','0','0'); -- id=4221
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6.5','00315', '287', '6', '315', '48', '8', '384', '0', '', '1', '2026-10-14 11:27:33', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','384','0','','0','0.00','0','0','0','0'); -- id=2300
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 2300;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-10-14', 384, 312, 312
                    , 312, 312, 312, 312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 48, 0, 312, 312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+48
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 384, 312, 312
                    , 312, 312, 312, 312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 312, 312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '583', userid = '1', storedetaildate = '2026-10-14 11:27:33' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '48', '1', '287', 'اضافة فاتورة مبيعات', 'sellbillController.php', '631', '583', '1', '2026-10-14 11:27:33','0','0'); -- id=4222
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '287', '24', '291', '2', '28', '56', '0', '', '1', '2026-10-14 11:27:33', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','99-2,','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=2301
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 = 2301;
 INSERT INTO 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-14', 56, 51.2, 51.2
                    , 50.42, 51.2, 50.42, 50.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 51.2, 50.42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 56, 51.2, 51.2
                    , 50.42, 51.2, 50.42, 50.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 51.2, 50.42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '1', storedetaildate = '2026-10-14 11:27:33' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '2', '1', '287', 'اضافة فاتورة مبيعات', 'sellbillController.php', '116', '114', '1', '2026-10-14 11:27:33','0','0'); -- id=4223
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', '287', '12', '84', '1', '195', '195', '0', '', '1', '2026-10-14 11:27:33', '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=2302
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 = 2302;
 INSERT INTO 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-14', 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-14', 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 = '55', userid = '1', storedetaildate = '2026-10-14 11:27:34' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '1', '1', '287', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '55', '1', '2026-10-14 11:27:34','0','0'); -- id=4224
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-813342.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 ('-815777.9375','2435', '0', '1', 'اضافة فاتورة مبيعات', '287', '-813342.9375', '2026-10-14 11:27:34', '1',  'sellbillController.php','1','','0'); -- id=302
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2435', '2435', '2026-10-14', '1', '0', '0', '2026-10-14 11:27:34','اضافة فاتورة مبيعات رقم 287','1','0',null,'0','287','sellbillController.php?do=showDetail&sellbillid=287'); -- id=1572
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1572', '383', '2435', '','0'); -- id=1584
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-18329.21', 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 ('1572', '143', '2435', '','0'); -- id=1575
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1227882.23', 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 ( '2123.2', '2123.2', '2026-10-14', '1', '0', '0', '2026-10-14 11:27:34','اضافة فاتورة مبيعات رقم 287 - صرف البضاعة من المخزن','1','0',null,'0','287','sellbillController.php?do=showDetail&sellbillid=287'); -- id=1573
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1573', '402', '2123.2', '','0'); -- id=1585
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1098121.58', 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 ('1573', '382', '2123.2', '','0'); -- id=1576
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2357607.86', 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='1572,0,1573' where sellbillid=287;
 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-14', 2435, 2123.2, 2123.2
                    , 2122.42, 2123.2, 2122.42, 2122.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2123.2, 2122.42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2435, sellCostBuyPrice =sellCostBuyPrice+2123.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2123.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2122.42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2123.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2122.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2122.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2123.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2122.42
                        , returnSellVal = returnSellVal+0, 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-14', 2435, 2123.2, 2123.2
                    , 2122.42, 2123.2, 2122.42, 2122.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2123.2, 2122.42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2435, sellCostBuyPrice =sellCostBuyPrice+2123.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2123.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2122.42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2123.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2122.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2122.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2123.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2122.42
                        , returnSellVal = returnSellVal+0, 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, 2435, 2123.2, 2123.2
                    , 2122.42, 2123.2, 2122.42, 2122.28, 2123.2, 2122.42)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2435, netSellCostBuyPrice = netSellCostBuyPrice+2123.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2123.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2122.42
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2123.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2122.42
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2122.28
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2123.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2122.42;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf4a17e3a36 and sellbillId = 287 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 07:57:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 11:27:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 11:27:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4123
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 09:03:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 12:33:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 12:33:14', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4124

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf4b0898fc1
-- ----------------------------------------------------------------------------------------------------

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-14 12:33:14', '06acf4b0898fc1', '1', '0.00', '0', '0', '1', '528.00', '528', '528', '0', '1', '2026-10-14 12:33:14', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','528','0','','0','0','528','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=288
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','اضافة فاتورة مبيعات','288', '0', '2026-10-14 12:33:15', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '528', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 12:33:14','0','0','',''); -- id=487
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 157;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00012', '288', '1', '12', '8', '66', '528', '0', '', '1', '2026-10-14 12:33:15', '12', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','157-8,','1','1','0','0','66','528','0','','0','0.00','0','0','0','0'); -- id=2303
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 2303;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-10-14', 528, 504, 504
                    , 504, 504, 504, 504
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 504, 504, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+504
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+504, sellCostMeanBuyPrice = sellCostMeanBuyPrice+504
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+504, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+504
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+504
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+504
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+504
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 528, 504, 504
                    , 504, 504, 504, 504
                    , 0, 0, 0, 0
                    , 0, 0, 0, 504, 504, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+504
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+504, sellCostMeanBuyPrice = sellCostMeanBuyPrice+504
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+504, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+504
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+504
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+504
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+504
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '327', userid = '1', storedetaildate = '2026-10-14 12:33:15' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '8', '1', '288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '335', '327', '1', '2026-10-14 12:33:15','0','0'); -- id=4225
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-812814.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 ('-813342.9375','528', '0', '1', 'اضافة فاتورة مبيعات', '288', '-812814.9375', '2026-10-14 12:33:16', '1',  'sellbillController.php','1','','0'); -- id=303
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '528', '528', '2026-10-14', '1', '0', '0', '2026-10-14 12:33:16','اضافة فاتورة مبيعات رقم 288','1','0',null,'0','288','sellbillController.php?do=showDetail&sellbillid=288'); -- id=1574
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1574', '383', '528', '','0'); -- id=1586
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-17801.21', 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 ('1574', '143', '528', '','0'); -- id=1577
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1228410.23', 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 ( '504', '504', '2026-10-14', '1', '0', '0', '2026-10-14 12:33:16','اضافة فاتورة مبيعات رقم 288 - صرف البضاعة من المخزن','1','0',null,'0','288','sellbillController.php?do=showDetail&sellbillid=288'); -- id=1575
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1575', '402', '504', '','0'); -- id=1587
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1098625.58', 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 ('1575', '382', '504', '','0'); -- id=1578
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2357103.86', 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='1574,0,1575' where sellbillid=288;
 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-14', 528, 504, 504
                    , 504, 504, 504, 504
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,504, 504, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+504
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+504, sellCostMeanBuyPrice = sellCostMeanBuyPrice+504
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+504, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+504
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+504
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+504
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+504
                        , returnSellVal = returnSellVal+0, 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-14', 528, 504, 504
                    , 504, 504, 504, 504
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,504, 504, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+504
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+504, sellCostMeanBuyPrice = sellCostMeanBuyPrice+504
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+504, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+504
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+504
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+504
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+504
                        , returnSellVal = returnSellVal+0, 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, 528, 504, 504
                    , 504, 504, 504, 504, 504, 504)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+528, netSellCostBuyPrice = netSellCostBuyPrice+504
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+504
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+504
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+504
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+504
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+504
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+504
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+504;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf4b0898fc1 and sellbillId = 288 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 09:03:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 12:33:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 12:33:17', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4125
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:30:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:00:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:00:24', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4126
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:30:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:00:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:00:52', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4127
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 ('نجفه كريستال 60 سنتي','','16','1400','1600','1600','1600','2026-10-14','0','1','0','','0','0','0','0','0','1400','1400','1400','1400','1400','0','14.29','0','0','.','0','0','0','1400','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','1400','1400','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','1400','0','0','0','0','0','0','','','0','0','0','0'); -- id=593
UPDATE product SET productName = 'نجفه كريستال 60 سنتي', productDescription = '', productCatId = '16', productBuyPrice = '1400', productSellAllPrice = '1600', productSellUnitPrice = '1600', productSellHalfPrice = '1600', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00593',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1400',lastbuyprice_withDiscount = '1400',meanbuyprice = '1400',meanbuyprice_withDiscount = '1400' , productbuypricereal = '1400' , buypricereal_precentage = '0' , buytotal_precentage = '14.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1400',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='1400',meanbuyprice_withTax='1400',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='1400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '593';
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', '593', '1.00', '2026-10-14', '1', '0','0059301','1600','1600','1600','1400','','0','0','0','0','0','0','0','0','0','0'); -- id=593
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('593', '1', '1', '1', '2026-10-14'); -- id=593
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '1', '0', '593', 'إضافة منتج', 'productController.php', '0', '1', '1', '2026-10-14','0','0'); -- id=4226
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (593, 1,'2026-10-14 14:00:54',1)
                ON DUPLICATE KEY UPDATE productid = 593, edited = 1, sysdate = '2026-10-14 14:00:54', userid = 1; -- id=753
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1400', '1400', '2026-10-14', '1', '0', '0', '2026-10-14 14:00:54','إضافة منتج نجفه كريستال 60 سنتي الكمية 1','1','0','0','0','593','productController.php?do=edit&id=593'); -- id=1576
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1576', '382', '1400', '','0'); -- id=1588
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2358503.86', 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 ('1576', '121', '1400', '','0'); -- id=1579
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1830689.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';
UPDATE product SET productName = 'نجفه كريستال 60 سنتي', productDescription = '', productCatId = '16', productBuyPrice = '1400.00', productSellAllPrice = '1600.00', productSellUnitPrice = '1600.00', productSellHalfPrice = '1600.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00593',type ='0', expireDate = '0' , dailyentryId = '1576',isService = '0',isOptic = '0',lastbuyprice = '1400',lastbuyprice_withDiscount = '1400',meanbuyprice = '1400',meanbuyprice_withDiscount = '1400' , productbuypricereal = '1400' , buypricereal_precentage = '0' , buytotal_precentage = '14.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1400',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='1400',meanbuyprice_withTax='1400',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='1400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '593';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:30:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:00:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:00:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4128
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:31:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:01:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:01:19', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4129
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:31:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:01:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:01:42', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4130
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:32:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:02:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:02:11', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4131
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 ('ابليك سيف اسمر 60 سنتي ','','16','125','135','145','135','2026-10-14','0','1','0','','0','0','0','0','0','125','125','125','125','125','0','8','8','16','.','0','0','0','125','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','125','125','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','125','0','0','0','0','0','0','','','0','0','0','0'); -- id=594
UPDATE product SET productName = 'ابليك سيف اسمر 60 سنتي ', productDescription = '', productCatId = '16', productBuyPrice = '125', productSellAllPrice = '135', productSellUnitPrice = '145', productSellHalfPrice = '135', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00594',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '125',lastbuyprice_withDiscount = '125',meanbuyprice = '125',meanbuyprice_withDiscount = '125' , productbuypricereal = '125' , buypricereal_precentage = '0' , buytotal_precentage = '8' , buyhalf_precentage = '8' , buypart_precentage = '16',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='125',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='125',meanbuyprice_withTax='125',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='125',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '594';
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', '594', '1.00', '2026-10-14', '1', '0','0059401','135','135','145','125','','0','0','0','0','0','0','0','0','0','0'); -- id=594
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('594', '1', '8', '1', '2026-10-14'); -- id=594
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('594', '1', '8', '0', '594', 'إضافة منتج', 'productController.php', '0', '8', '1', '2026-10-14','0','0'); -- id=4227
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (594, 1,'2026-10-14 14:02:12',1)
                ON DUPLICATE KEY UPDATE productid = 594, edited = 1, sysdate = '2026-10-14 14:02:12', userid = 1; -- id=754
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1000', '1000', '2026-10-14', '1', '0', '0', '2026-10-14 14:02:12','إضافة منتج ابليك سيف اسمر 60 سنتي  الكمية 8','1','0','0','0','594','productController.php?do=edit&id=594'); -- id=1577
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1577', '382', '1000', '','0'); -- id=1589
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2359503.86', 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 ('1577', '121', '1000', '','0'); -- id=1580
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1831689.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';
UPDATE product SET productName = 'ابليك سيف اسمر 60 سنتي ', productDescription = '', productCatId = '16', productBuyPrice = '125.00', productSellAllPrice = '135.00', productSellUnitPrice = '145.00', productSellHalfPrice = '135.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00594',type ='0', expireDate = '0' , dailyentryId = '1577',isService = '0',isOptic = '0',lastbuyprice = '125',lastbuyprice_withDiscount = '125',meanbuyprice = '125',meanbuyprice_withDiscount = '125' , productbuypricereal = '125' , buypricereal_precentage = '0' , buytotal_precentage = '8' , buyhalf_precentage = '8' , buypart_precentage = '16',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='125',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='125',meanbuyprice_withTax='125',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='125',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '594';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:32:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:02:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:02:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4132
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:32:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:02:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:02:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4133
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:32:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:02:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:02:46', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4134

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf6f5671c50
-- ----------------------------------------------------------------------------------------------------

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-14 14:02:47', '06acf6f5671c50', '1', '0.00', '0', '0', '1', '435.00', '435', '435', '0', '1', '2026-10-14 14:02:47', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','435','0','','0','0','435','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=289
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','اضافة فاتورة مبيعات','289', '0', '2026-10-14 14:02:48', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '435', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 14:02:47','0','0','',''); -- id=488
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('125','00594', '289', '16', '594', '3', '145', '435', '0', '', '1', '2026-10-14 14:02:48', '594', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','145','435','0','','0','0.00','0','0','0','0'); -- id=2304
UPDATE sellbilldetail SET  lastbuyprice = 125.00 , meanbuyprice = 125.00, lastbuyprice_withDiscount = 125.00, meanbuyprice_withDiscount = 125.00
        , lastbuyprice_withTax = 125, meanbuyprice_withTax = 125, lastbuyprice_withDiscountAndTax = 125
                where sellbilldetailid = 2304;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (594, '2026-10-14', 435, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 435, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:02:48' WHERE storedetailid = '594';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('594', '1', '3', '1', '289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '5', '1', '2026-10-14 14:02:48','0','0'); -- id=4228
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-812379.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 ('-812814.9375','435', '0', '1', 'اضافة فاتورة مبيعات', '289', '-812379.9375', '2026-10-14 14:02:48', '1',  'sellbillController.php','1','','0'); -- id=304
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '435', '435', '2026-10-14', '1', '0', '0', '2026-10-14 14:02:49','اضافة فاتورة مبيعات رقم 289','1','0',null,'0','289','sellbillController.php?do=showDetail&sellbillid=289'); -- id=1578
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1578', '383', '435', '','0'); -- id=1590
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-17366.21', 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 ('1578', '143', '435', '','0'); -- id=1581
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1228845.23', 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 ( '375', '375', '2026-10-14', '1', '0', '0', '2026-10-14 14:02:49','اضافة فاتورة مبيعات رقم 289 - صرف البضاعة من المخزن','1','0',null,'0','289','sellbillController.php?do=showDetail&sellbillid=289'); -- id=1579
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1579', '402', '375', '','0'); -- id=1591
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1099000.58', 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 ('1579', '382', '375', '','0'); -- id=1582
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2359128.86', 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='1578,0,1579' where sellbillid=289;
 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-14', 435, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, 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-14', 435, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, 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, 435, 375, 375
                    , 375, 375, 375, 375, 375, 375)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+435, netSellCostBuyPrice = netSellCostBuyPrice+375
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+375
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+375
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+375
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+375
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+375
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+375
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+375;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf6f5671c50 and sellbillId = 289 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:32:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:02:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:02:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4135
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:48:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:18:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:18:46', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4136

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf5a6e3df51
-- ----------------------------------------------------------------------------------------------------

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-14 14:18:46', '06acf5a6e3df51', '1', '0.00', '0', '0', '1', '5686.00', '5686', '5686', '0', '1', '2026-10-14 14:18:46', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','5686','0','','0','0','5686','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=290
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','اضافة فاتورة مبيعات','290', '0', '2026-10-14 14:18:47', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5686', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 14:18:46','0','0','',''); -- id=489
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('875','00491', '290', '16', '491', '1', '1050', '1050', '0', '', '1', '2026-10-14 14:18:47', '491', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1050','1050','0','','0','0.00','0','0','0','0'); -- id=2305
UPDATE sellbilldetail SET  lastbuyprice = 875.00 , meanbuyprice = 875.00, lastbuyprice_withDiscount = 875.00, meanbuyprice_withDiscount = 875.00
        , lastbuyprice_withTax = 875, meanbuyprice_withTax = 875, lastbuyprice_withDiscountAndTax = 875
                where sellbilldetailid = 2305;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (491, '2026-10-14', 1050, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 1050, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:18:47' WHERE storedetailid = '491';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('491', '1', '1', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-10-14 14:18:47','0','0'); -- id=4229
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('850','00492', '290', '16', '492', '1', '990', '990', '0', '', '1', '2026-10-14 14:18:47', '492', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','990','990','0','','0','0.00','0','0','0','0'); -- id=2306
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 2306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (492, '2026-10-14', 990, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 990, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-14 14:18:48' WHERE storedetailid = '492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('492', '1', '1', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-14 14:18:48','0','0'); -- id=4230
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','00511', '290', '16', '511', '2', '515', '1030', '0', '', '1', '2026-10-14 14:18:48', '511', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','515','1030','0','','0','0.00','0','0','0','0'); -- id=2307
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 2307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (511, '2026-10-14', 1030, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1030, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 1030, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1030, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-14 14:18:48' WHERE storedetailid = '511';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('511', '1', '2', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '4', '1', '2026-10-14 14:18:48','0','0'); -- id=4231
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 32;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','00378', '290', '16', '378', '2', '485', '970', '0', '', '1', '2026-10-14 14:18:48', '378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','32-2,','1','1','0','0','485','970','0','','0','0.00','0','0','0','0'); -- id=2308
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 2308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-14', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-14 14:18:48' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '25', '1', '2026-10-14 14:18:48','0','0'); -- id=4232
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1400','00593', '290', '16', '593', '1', '1600', '1600', '0', '', '1', '2026-10-14 14:18:48', '593', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1600','1600','0','','0','0.00','0','0','0','0'); -- id=2309
UPDATE sellbilldetail SET  lastbuyprice = 1400.00 , meanbuyprice = 1400.00, lastbuyprice_withDiscount = 1400.00, meanbuyprice_withDiscount = 1400.00
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where sellbilldetailid = 2309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (593, '2026-10-14', 1600, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 1600, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:18:49' WHERE storedetailid = '593';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '1', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-14 14:18:49','0','0'); -- id=4233
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '290', '6', '527', '2', '23', '46', '0', '', '1', '2026-10-14 14:18:49', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','46','0','','0','0.00','0','0','0','0'); -- id=2310
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 = 2310;
 INSERT INTO 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-14', 46, 38, 38
                    , 38, 38, 38, 38
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 38, 38, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46, sellCostBuyPrice =sellCostBuyPrice+38
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+38, sellCostMeanBuyPrice = sellCostMeanBuyPrice+38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+38, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+38
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+38
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 46, 38, 38
                    , 38, 38, 38, 38
                    , 0, 0, 0, 0
                    , 0, 0, 0, 38, 38, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46, sellCostBuyPrice =sellCostBuyPrice+38
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+38, sellCostMeanBuyPrice = sellCostMeanBuyPrice+38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+38, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+38
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+38
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:18:49' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '2', '1', '290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '12', '1', '2026-10-14 14:18:49','0','0'); -- id=4234
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-806693.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 ('-812379.9375','5686', '0', '1', 'اضافة فاتورة مبيعات', '290', '-806693.9375', '2026-10-14 14:18:49', '1',  'sellbillController.php','1','','0'); -- id=305
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5686', '5686', '2026-10-14', '1', '0', '0', '2026-10-14 14:18:49','اضافة فاتورة مبيعات رقم 290','1','0',null,'0','290','sellbillController.php?do=showDetail&sellbillid=290'); -- id=1580
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1580', '383', '5686', '','0'); -- id=1592
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-11680.21', 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 ('1580', '143', '5686', '','0'); -- id=1583
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1234531.23', 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 ( '4913', '4913', '2026-10-14', '1', '0', '0', '2026-10-14 14:18:49','اضافة فاتورة مبيعات رقم 290 - صرف البضاعة من المخزن','1','0',null,'0','290','sellbillController.php?do=showDetail&sellbillid=290'); -- id=1581
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1581', '402', '4913', '','0'); -- id=1593
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1103913.58', 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 ('1581', '382', '4913', '','0'); -- id=1584
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2354215.86', 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='1580,0,1581' where sellbillid=290;
 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-14', 5686, 4913, 4913
                    , 4913, 4913, 4913, 4913
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4913, 4913, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5686, sellCostBuyPrice =sellCostBuyPrice+4913
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4913, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4913
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4913, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4913
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4913
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4913
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4913
                        , returnSellVal = returnSellVal+0, 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-14', 5686, 4913, 4913
                    , 4913, 4913, 4913, 4913
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4913, 4913, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5686, sellCostBuyPrice =sellCostBuyPrice+4913
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4913, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4913
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4913, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4913
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4913
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4913
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4913
                        , returnSellVal = returnSellVal+0, 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, 5686, 4913, 4913
                    , 4913, 4913, 4913, 4913, 4913, 4913)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5686, netSellCostBuyPrice = netSellCostBuyPrice+4913
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4913
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4913
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4913
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4913
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4913
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4913
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4913;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf5a6e3df51 and sellbillId = 290 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 10:48:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:18:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:18:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4137
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 11:02:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:32:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:32:40', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4138
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 11:03:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:33:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:33:22', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4139
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 ('لوحه 12 خط بالعداد مصطفي خليل ','','6','225','235','235','235','2026-10-14','0','1','0','','0','0','0','0','0','225','225','225','225','225','0','4.44','4.44','4.44','.','0','0','0','225','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','225','225','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','225','0','0','0','0','0','0','','','0','0','0','0'); -- id=595
UPDATE product SET productName = 'لوحه 12 خط بالعداد مصطفي خليل ', productDescription = '', productCatId = '6', productBuyPrice = '225', productSellAllPrice = '235', productSellUnitPrice = '235', productSellHalfPrice = '235', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00595',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '225',lastbuyprice_withDiscount = '225',meanbuyprice = '225',meanbuyprice_withDiscount = '225' , productbuypricereal = '225' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '4.44' , buypart_precentage = '4.44',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='225',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='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 = '595';
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', '595', '1.00', '2026-10-14', '1', '0','0059501','235','235','235','225','','0','0','0','0','0','0','0','0','0','0'); -- id=595
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('595', '1', '3', '1', '2026-10-14'); -- id=595
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('595', '1', '3', '0', '595', 'إضافة منتج', 'productController.php', '0', '3', '1', '2026-10-14','0','0'); -- id=4235
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (595, 1,'2026-10-14 14:33:23',1)
                ON DUPLICATE KEY UPDATE productid = 595, edited = 1, sysdate = '2026-10-14 14:33:23', userid = 1; -- id=755
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '675', '675', '2026-10-14', '1', '0', '0', '2026-10-14 14:33:23','إضافة منتج لوحه 12 خط بالعداد مصطفي خليل  الكمية 3','1','0','0','0','595','productController.php?do=edit&id=595'); -- id=1582
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1582', '382', '675', '','0'); -- id=1594
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2354890.86', 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 ('1582', '121', '675', '','0'); -- id=1585
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1832364.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';
UPDATE product SET productName = 'لوحه 12 خط بالعداد مصطفي خليل ', productDescription = '', productCatId = '6', productBuyPrice = '225.00', productSellAllPrice = '235.00', productSellUnitPrice = '235.00', productSellHalfPrice = '235.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00595',type ='0', expireDate = '0' , dailyentryId = '1582',isService = '0',isOptic = '0',lastbuyprice = '225',lastbuyprice_withDiscount = '225',meanbuyprice = '225',meanbuyprice_withDiscount = '225' , productbuypricereal = '225' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '4.44' , buypart_precentage = '4.44',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='225',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='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 = '595';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 11:03:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:33:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 14:33:26', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4140
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 11:10:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:40:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:40:02', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4141

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf732bea69e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-14 14:40:03', '06acf732bea69e', '3', '3757.80', '9517.8', '0', '1', '5760.00', '5760', '0', '5760', '1', '2026-10-14 14:40:03', '', '1', '0', 'عبدالحي الشاذلي ', '1', '1', '3', '0', '3 - عبدالحي الشاذلي ', '278' ,'0','','','','','-1','0','0','0','0','0','5760','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=291
UPDATE client SET  clientdebt = '9517.8', userid = '1' WHERE clientid = '3';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','3757.80','5760','0','اضافة فاتورة مبيعات','291', '9517.8', '2026-10-14 14:40:03', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5760', '0', null, '0', null, null,'', '0','1','1','5760','1','2026-10-14 14:40:03','0','0','',''); -- id=490
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00387', '291', '7', '387', '10', '92', '920', '0', '', '0', '2026-10-14 14:40:04', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','92','920','0','','0','','0','0','0','0'); -- id=2311
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 2311;
 INSERT INTO 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-14', 920, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+920, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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+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-14', 920, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+920, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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 = '32', userid = '1', storedetaildate = '2026-10-14 14:40:04' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '32', '1', '2026-10-14 14:40:04','0','0'); -- id=4236
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 106;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('966','00523', '291', '6', '523', '1', '965', '965', '0', '', '0', '2026-10-14 14:40:04', '523', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','106-1,','1','1','0','0','965','965','0','','0','','0','0','0','0'); -- id=2312
UPDATE sellbilldetail SET  lastbuyprice = 941.00 , meanbuyprice = 952.84, lastbuyprice_withDiscount = 941.00, meanbuyprice_withDiscount = 952.84
        , lastbuyprice_withTax = 941, meanbuyprice_withTax = 952.84, lastbuyprice_withDiscountAndTax = 941
                where sellbilldetailid = 2312;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (523, '2026-10-14', 965, 941, 941
                    , 952.84, 941, 952.84, 953.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 941, 952.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+965, sellCostBuyPrice =sellCostBuyPrice+941
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+941, sellCostMeanBuyPrice = sellCostMeanBuyPrice+952.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+941, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+952.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+953.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+941
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+952.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+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-14', 965, 941, 941
                    , 952.84, 941, 952.84, 953.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 941, 952.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+965, sellCostBuyPrice =sellCostBuyPrice+941
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+941, sellCostMeanBuyPrice = sellCostMeanBuyPrice+952.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+941, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+952.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+953.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+941
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+952.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 = '18', userid = '1', storedetaildate = '2026-10-14 14:40:04' WHERE storedetailid = '523';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('523', '1', '1', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '18', '1', '2026-10-14 14:40:04','0','0'); -- id=4237
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 105;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('960','00522', '291', '6', '522', '1', '960', '960', '0', '', '0', '2026-10-14 14:40:04', '522', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','105-1,','1','1','0','0','960','960','0','','0','0.00','0','0','0','0'); -- id=2313
UPDATE sellbilldetail SET  lastbuyprice = 934.40 , meanbuyprice = 945.23, lastbuyprice_withDiscount = 934.40, meanbuyprice_withDiscount = 945.23
        , lastbuyprice_withTax = 934.4, meanbuyprice_withTax = 945.23, lastbuyprice_withDiscountAndTax = 934.4
                where sellbilldetailid = 2313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (522, '2026-10-14', 960, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 960, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-14 14:40:05' WHERE storedetailid = '522';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('522', '1', '1', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26', '25', '1', '2026-10-14 14:40:05','0','0'); -- id=4238
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('565','00214', '291', '13', '214', '1', '575', '575', '0', '', '0', '2026-10-14 14:40:05', '214', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','575','575','0','','0','0.00','0','0','0','0'); -- id=2314
UPDATE sellbilldetail SET  lastbuyprice = 565.00 , meanbuyprice = 565.00, lastbuyprice_withDiscount = 565.00, meanbuyprice_withDiscount = 565.00
        , lastbuyprice_withTax = 565, meanbuyprice_withTax = 565, lastbuyprice_withDiscountAndTax = 565
                where sellbilldetailid = 2314;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (214, '2026-10-14', 575, 565, 565
                    , 565, 565, 565, 565
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 565, 565, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+575, sellCostBuyPrice =sellCostBuyPrice+565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+565
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+565
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+565
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+565
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 575, 565, 565
                    , 565, 565, 565, 565
                    , 0, 0, 0, 0
                    , 0, 0, 0, 565, 565, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+575, sellCostBuyPrice =sellCostBuyPrice+565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+565
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+565
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+565
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+565
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:40:05' WHERE storedetailid = '214';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('214', '1', '1', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-10-14 14:40:05','0','0'); -- id=4239
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.6','00585', '291', '12', '585', '20', '11', '220', '0', '', '0', '2026-10-14 14:40:05', '585', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11','220','0','','0','0.00','0','0','0','0'); -- id=2315
UPDATE sellbilldetail SET  lastbuyprice = 10.60 , meanbuyprice = 10.60, lastbuyprice_withDiscount = 10.60, meanbuyprice_withDiscount = 10.60
        , lastbuyprice_withTax = 10.6, meanbuyprice_withTax = 10.6, lastbuyprice_withDiscountAndTax = 10.6
                where sellbilldetailid = 2315;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (585, '2026-10-14', 220, 212, 212
                    , 212, 212, 212, 212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 212, 212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 220, 212, 212
                    , 212, 212, 212, 212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 212, 212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '130', userid = '1', storedetaildate = '2026-10-14 14:40:05' WHERE storedetailid = '585';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '1', '20', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '130', '1', '2026-10-14 14:40:05','0','0'); -- id=4240
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 179;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00220', '291', '13', '220', '2', '170', '340', '0', '', '0', '2026-10-14 14:40:05', '220', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','179-2,','1','1','0','0','170','340','0','','0','0.00','0','0','0','0'); -- id=2316
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.83, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.83
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160.83, lastbuyprice_withDiscountAndTax = 160
                where sellbilldetailid = 2316;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (220, '2026-10-14', 340, 320, 320
                    , 321.66, 320, 321.66, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 320, 321.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+321.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+321.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+321.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 340, 320, 320
                    , 321.66, 320, 321.66, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 320, 321.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+321.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+321.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+321.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:40:06' WHERE storedetailid = '220';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('220', '1', '2', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '10', '1', '2026-10-14 14:40:06','0','0'); -- id=4241
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 35;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00222', '291', '13', '222', '2', '110', '220', '0', '', '0', '2026-10-14 14:40:06', '222', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','35-2,','1','1','0','0','110','220','0','','0','0.00','0','0','0','0'); -- id=2317
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 = 2317;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (222, '2026-10-14', 220, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 220, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-14 14:40:06' WHERE storedetailid = '222';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('222', '1', '2', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '12', '1', '2026-10-14 14:40:06','0','0'); -- id=4242
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('225','00212', '291', '13', '212', '1', '240', '240', '0', '', '0', '2026-10-14 14:40:06', '212', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','240','240','0','','0','0.00','0','0','0','0'); -- id=2318
UPDATE sellbilldetail SET  lastbuyprice = 225.00 , meanbuyprice = 225.00, lastbuyprice_withDiscount = 225.00, meanbuyprice_withDiscount = 225.00
        , lastbuyprice_withTax = 225, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 225
                where sellbilldetailid = 2318;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (212, '2026-10-14', 240, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+225
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 240, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+225
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 14:40:06' WHERE storedetailid = '212';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('212', '1', '1', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-10-14 14:40:06','0','0'); -- id=4243
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+240 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.82','00388', '291', '20', '388', '240', '5.5', '1320', '0', '', '0', '2026-10-14 14:40:07', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','25-240,','1','1','0','0','5.5','1320','0','','0','0.00','0','0','0','0'); -- id=2319
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 2319;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-10-14', 1320, 1156.8, 1156.8
                    , 1156.8, 1156.8, 1156.8, 1156.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 240, 0, 1156.8, 1156.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1156.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1156.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1156.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1156.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1156.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1156.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1156.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1156.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+240
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 1320, 1156.8, 1156.8
                    , 1156.8, 1156.8, 1156.8, 1156.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1156.8, 1156.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1156.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1156.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1156.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1156.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1156.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1156.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1156.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1156.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 = '883', userid = '1', storedetaildate = '2026-10-14 14:40:07' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '240', '1', '291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1123', '883', '1', '2026-10-14 14:40:07','0','0'); -- id=4244
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5760', '5760', '2026-10-14', '1', '0', '0', '2026-10-14 14:40:07','اضافة فاتورة مبيعات رقم 291','1','0',null,'0','291','sellbillController.php?do=showDetail&sellbillid=291'); -- id=1583
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1583', '427', '5760', '','0'); -- id=1595
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '9517.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1583', '143', '5760', '','0'); -- id=1586
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1240291.23', 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 ( '5364.2', '5364.2', '2026-10-14', '1', '0', '0', '2026-10-14 14:40:07','اضافة فاتورة مبيعات رقم 291 - صرف البضاعة من المخزن','1','0',null,'0','291','sellbillController.php?do=showDetail&sellbillid=291'); -- id=1584
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1584', '402', '5364.2', '','0'); -- id=1596
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1109277.78', 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 ('1584', '382', '5364.2', '','0'); -- id=1587
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2349526.66', 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='1583,0,1584' where sellbillid=291;
 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-14', 5760, 5364.2, 5364.2
                    , 5394.33, 5364.2, 5394.33, 5389.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5364.2, 5394.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5760, sellCostBuyPrice =sellCostBuyPrice+5364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5394.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5394.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5389.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5394.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-14', 5760, 5364.2, 5364.2
                    , 5394.33, 5364.2, 5394.33, 5389.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5364.2, 5394.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5760, sellCostBuyPrice =sellCostBuyPrice+5364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5394.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5394.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5389.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5394.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5760, 5364.2, 5364.2
                    , 5394.33, 5364.2, 5394.33, 5389.5, 5364.2, 5394.33)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5760, netSellCostBuyPrice = netSellCostBuyPrice+5364.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5364.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5394.33
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5364.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5394.33
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5389.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5364.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5394.33;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf732bea69e and sellbillId = 291 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 11:10:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 14:40:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 14:40:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4142
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-14 16:56:00', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-14','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=64
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('64', '0', '0', '', ''); -- id=64
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 ('64','0','0','0','إضافة عميل جديد','64', '0', '2026-10-14 16:56:00', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=491
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-14 16:56:01'); -- id=497
UPDATE client SET clientname = 'م/محمود عز ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-14', 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='497',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 = '64';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:31:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:01:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:01:27', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4143

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acf7829b1876
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(64,@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-14 17:01:32', '06acf7829b1876', '64', '0.00', '0', '0', '1', '3015.00', '3015', '3015', '0', '1', '2026-10-14 17:01:32', '', '1', '0', 'م/محمود عز ', '1', '1', '3', '0', 'م/محمود عز ', '9' ,'0','','','','','-1','0','0','0','0','0','3015','0','','0','0','3015','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=292
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '64';
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 ('64','0.00','0','0','اضافة فاتورة مبيعات','292', '0', '2026-10-14 17:01:33', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3015', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 17:01:32','0','0','',''); -- id=492
UPDATE client SET  inUse = 0 where clientid = 64;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('475','00028', '292', '8', '28', '2', '525', '1050', '0', '', '0', '2026-10-14 17:01:33', '28', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','525','1050','0','','0','','0','0','0','0'); -- id=2320
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 475.00, meanbuyprice_withDiscount = 475.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 475
                where sellbilldetailid = 2320;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (28, '2026-10-14', 1050, 950, 950
                    , 950, 950, 950, 950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 950, 950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 1050, 950, 950
                    , 950, 950, 950, 950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 950, 950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 17:01:33' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '2', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13', '11', '1', '2026-10-14 17:01:33','0','0'); -- id=4245
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '292', '8', '428', '2', '285', '570', '0', '', '0', '2026-10-14 17:01:33', '428', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','285','570','0','','0','','0','0','0','0'); -- id=2321
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 = 2321;
 INSERT INTO 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-14', 570, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 570, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-14 17:01:34' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '2', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '42', '1', '2026-10-14 17:01:34','0','0'); -- id=4246
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '292', '8', '29', '2', '230', '460', '0', '', '0', '2026-10-14 17:01:34', '29', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','167-2,','1','1','0','0','230','460','0','','0','0.00','0','0','0','0'); -- id=2322
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 = 2322;
 INSERT INTO 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-14', 460, 400, 400
                    , 400, 400, 400, 400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 400, 400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 460, 400, 400
                    , 400, 400, 400, 400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 400, 400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-14 17:01:34' WHERE storedetailid = '29';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('29', '1', '2', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '28', '1', '2026-10-14 17:01:34','0','0'); -- id=4247
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('329','00031', '292', '8', '31', '2', '335', '670', '0', '', '0', '2026-10-14 17:01:34', '31', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','335','670','0','','0','0.00','0','0','0','0'); -- id=2323
UPDATE sellbilldetail SET  lastbuyprice = 329.00 , meanbuyprice = 329.00, lastbuyprice_withDiscount = 329.00, meanbuyprice_withDiscount = 329.00
        , lastbuyprice_withTax = 329, meanbuyprice_withTax = 329, lastbuyprice_withDiscountAndTax = 329
                where sellbilldetailid = 2323;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (31, '2026-10-14', 670, 658, 658
                    , 658, 658, 658, 658
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 658, 658, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+658
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+658, sellCostMeanBuyPrice = sellCostMeanBuyPrice+658
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+658, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+658
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+658
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+658
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+658
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 670, 658, 658
                    , 658, 658, 658, 658
                    , 0, 0, 0, 0
                    , 0, 0, 0, 658, 658, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+658
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+658, sellCostMeanBuyPrice = sellCostMeanBuyPrice+658
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+658, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+658
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+658
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+658
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+658
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 17:01:35' WHERE storedetailid = '31';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('31', '1', '2', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '13', '1', '2026-10-14 17:01:35','0','0'); -- id=4248
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('255','00035', '292', '8', '35', '1', '265', '265', '0', '', '0', '2026-10-14 17:01:35', '35', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','265','265','0','','0','0.00','0','0','0','0'); -- id=2324
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 = 2324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (35, '2026-10-14', 265, 255, 255
                    , 255, 255, 255, 255
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 255, 255, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+265, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+255
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+255
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+255
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 265, 255, 255
                    , 255, 255, 255, 255
                    , 0, 0, 0, 0
                    , 0, 0, 0, 255, 255, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+265, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+255
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+255
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+255
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 17:01:35' WHERE storedetailid = '35';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('35', '1', '1', '1', '292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '19', '1', '2026-10-14 17:01:35','0','0'); -- id=4249
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-803678.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 ('-806693.9375','3015', '0', '1', 'اضافة فاتورة مبيعات', '292', '-803678.9375', '2026-10-14 17:01:35', '1',  'sellbillController.php','64','','0'); -- id=306
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3015', '3015', '2026-10-14', '1', '0', '0', '2026-10-14 17:01:35','اضافة فاتورة مبيعات رقم 292','1','0',null,'0','292','sellbillController.php?do=showDetail&sellbillid=292'); -- id=1585
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1585', '497', '3015', '','0'); -- id=1597
UPDATE accountstree SET name = 'م/محمود عز ', customName = 'م/محمود عز ', customNameEn = 'م/محمود عز ', nameEn = 'م/محمود عز ', parent = '58', accountNature = '0', theValue = '3015', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 16:56:01' WHERE id = '497';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1585', '143', '3015', '','0'); -- id=1588
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1243306.23', 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 ( '3015', '3015', '2026-10-14', '1', '0', '0', '2026-10-14 17:01:35','اضافة فاتورة مبيعات رقم 292 - تحصيل الفاتورة من العميل','1','0',null,'0','292','sellbillController.php?do=showDetail&sellbillid=292'); -- id=1586
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1586', '383', '3015', '','0'); -- id=1598
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-8665.21', 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 ('1586', '497', '3015', '','0'); -- id=1589
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-14 16:56:01' WHERE id = '497';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2763', '2763', '2026-10-14', '1', '0', '0', '2026-10-14 17:01:35','اضافة فاتورة مبيعات رقم 292 - صرف البضاعة من المخزن','1','0',null,'0','292','sellbillController.php?do=showDetail&sellbillid=292'); -- id=1587
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1587', '402', '2763', '','0'); -- id=1599
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1112040.78', 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 ('1587', '382', '2763', '','0'); -- id=1590
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2346763.66', 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='1585,1586,1587' where sellbillid=292;
 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-14', 3015, 2763, 2763
                    , 2763, 2763, 2763, 2763
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2763, 2763, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3015, sellCostBuyPrice =sellCostBuyPrice+2763
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2763, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2763
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2763, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2763
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2763
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2763
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2763
                        , returnSellVal = returnSellVal+0, 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 (64, '2026-10-14', 3015, 2763, 2763
                    , 2763, 2763, 2763, 2763
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2763, 2763, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3015, sellCostBuyPrice =sellCostBuyPrice+2763
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2763, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2763
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2763, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2763
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2763
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2763
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2763
                        , returnSellVal = returnSellVal+0, 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, 3015, 2763, 2763
                    , 2763, 2763, 2763, 2763, 2763, 2763)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3015, netSellCostBuyPrice = netSellCostBuyPrice+2763
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2763
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2763
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2763
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2763
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2763
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2763
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2763;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acf7829b1876 and sellbillId = 292 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:31:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:01:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:01:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4144
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:33:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:03:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:03:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4145
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:34:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:04:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:04:57', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4146

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =493
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '3517.8' , clientdate = '2026-10-14 17:04:58', userid = '1' WHERE clientid = '3';
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','9517.80','6000','1','ايصال تحصيل (( قبض من عميل ))','493', '3517.8', '2026-10-14 17:03:02', '1', 'clientPayedDeptController.php', '   ', '6000', '0', null, '0', null, null,'', '-1','1','1','6000','1','','46','0','','.'); -- id=493
UPDATE save SET  savecurrentvalue = '-797678.94',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-803678.94','6000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '493', '-797678.94', '2026-10-14 17:04:58', '1',  'clientPayedDeptController.php','3','','0'); -- id=307
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6000', '6000', '2026-10-14', '1', '0', '0', '2026-10-14 17:04:58','اضافة ايصال سداد للعميل عبدالحي الشاذلي ','1','0','0','0','493','clientPayedDeptController.php?do=show&id=493'); -- id=1588
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1588', '383', '6000', '','0'); -- id=1600
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2665.21', 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 ('1588', '427', '6000', '','0'); -- id=1591
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '3517.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
UPDATE clientdebtchange SET clientid = '3', clientdebtchangebefore = '9517.800', clientdebtchangeamount = '6000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '493', clientdebtchangeafter = '3517.800', clientdebtchangedate = '2026-10-14 17:03:02', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '6000.000',discount='', reciptid='0', dailyentryid = '1588',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='6000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '493';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:34:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:04:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:04:59', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4147
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:35:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:05:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:05:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4148
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 13:35:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:05:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:05:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4149
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:11:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:41:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 17:41:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4150
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 17:42:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4151
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:42:09', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=292'); -- id=4152
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:42:32', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=4153
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:42:33', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4154
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:42:46', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4155
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:12:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:42:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:00', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4156
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:13:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:43:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:07', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4157
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:13:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:43:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:14', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4158
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:13:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:43:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:32', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4159
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:13:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:43:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:51', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4160
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:13:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:43:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:43:59', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4161
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:14:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:44:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:44:40', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4162
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:14:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:44:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 17:44:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4163
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:15:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:45:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 17:45:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4164
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:15:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:45:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:45:09', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=255'); -- id=4165
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:15:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:45:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:45:59', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4166
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:16:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:46:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:46:11', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4167

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =494
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(41,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-14 17:46:12', userid = '1' WHERE clientid = '41';
UPDATE client SET  inUse = 0 where clientid = 41;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('41','1478.70','1478.7','1','ايصال تحصيل (( قبض من عميل ))','494', '0', '2026-10-14 17:45:59', '1', 'clientPayedDeptController.php', '   ', '1478.7', '0', null, '0', null, null,'', '-1','1','1','1478.7','1','','47','0','','.'); -- id=494
UPDATE save SET  savecurrentvalue = '-796200.24',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-797678.94','1478.7', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '494', '-796200.24', '2026-10-14 17:46:12', '1',  'clientPayedDeptController.php','41','','0'); -- id=308
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1478.7', '1478.7', '2026-10-14', '1', '0', '0', '2026-10-14 17:46:12','اضافة ايصال سداد للعميل احمد سعد','1','0','0','0','494','clientPayedDeptController.php?do=show&id=494'); -- id=1589
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1589', '383', '1478.7', '','0'); -- id=1601
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-1186.51', 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 ('1589', '473', '1478.7', '','0'); -- id=1592
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
UPDATE clientdebtchange SET clientid = '41', clientdebtchangebefore = '1478.700', clientdebtchangeamount = '1478.700', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '494', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-14 17:45:59', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '1478.700',discount='', reciptid='0', dailyentryid = '1589',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1478.7',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '494';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:16:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:46:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:46:13', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4168
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:16:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:46:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 17:46:15', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4169
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:16:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:46:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:46:27', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4170
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:16:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:46:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-14 17:46:47', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4171
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:17:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:47:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:47:00', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4172
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:29:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:59:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:59:53', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4173

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfa3f4f36b8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(7,@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-14 17:59:53', '06acfa3f4f36b8', '7', '2915.00', '3800', '0', '1', '885.00', '885', '0', '885', '1', '2026-10-14 17:59:53', '', '1', '0', 'سامي الشربيني', '1', '1', '3', '0', '7 - سامي الشربيني', '3' ,'0','','','','','-1','0','0','0','0','0','885','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=293
UPDATE client SET  clientdebt = '3800', userid = '1' WHERE clientid = '7';
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 ('7','2915.00','885','0','اضافة فاتورة مبيعات','293', '3800', '2026-10-14 17:59:54', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '885', '0', null, '0', null, null,'', '0','1','1','885','1','2026-10-14 17:59:53','0','0','',''); -- id=495
UPDATE client SET  inUse = 0 where clientid = 7;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','00246', '293', '23', '246', '3', '295', '885', '0', '', '1', '2026-10-14 17:59:54', '246', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','885','0','','0','0.00','0','0','0','0'); -- id=2325
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 2325;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (246, '2026-10-14', 885, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 885, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-14 17:59:54' WHERE storedetailid = '246';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('246', '1', '3', '1', '293', 'اضافة فاتورة مبيعات', 'sellbillController.php', '38', '35', '1', '2026-10-14 17:59:54','0','0'); -- id=4250
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '885', '885', '2026-10-14', '1', '0', '0', '2026-10-14 17:59:55','اضافة فاتورة مبيعات رقم 293','1','0',null,'0','293','sellbillController.php?do=showDetail&sellbillid=293'); -- id=1590
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1590', '434', '885', '','0'); -- id=1602
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '3800', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1590', '143', '885', '','0'); -- id=1593
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1244191.23', 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 ( '780', '780', '2026-10-14', '1', '0', '0', '2026-10-14 17:59:55','اضافة فاتورة مبيعات رقم 293 - صرف البضاعة من المخزن','1','0',null,'0','293','sellbillController.php?do=showDetail&sellbillid=293'); -- id=1591
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1591', '402', '780', '','0'); -- id=1603
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1112820.78', 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 ('1591', '382', '780', '','0'); -- id=1594
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2345983.66', 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='1590,0,1591' where sellbillid=293;
 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-14', 885, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (7, '2026-10-14', 885, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 885, 780, 780
                    , 780, 780, 780, 780, 780, 780)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+885, netSellCostBuyPrice = netSellCostBuyPrice+780
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+780
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+780
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+780
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+780
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+780
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+780;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfa3f4f36b8 and sellbillId = 293 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:29:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 17:59:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 17:59:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4174
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:32:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:02:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 18:02:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4175
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:32:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:02:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 18:02:56', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=4176
BEGIN;
CALL supplierInUse(15,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('15', '14108.00', '5000', '1', 'ايصال دفع لمورد', '1', '9108', '2026-10-14 18:02:45', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','5000','1','0','0','0','25',''); -- id=91
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '14108.00', supplierdebtchangeamount = '5000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '9108', supplierdebtchangedate = '2026-10-14 18:02:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='5000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='14108',debtchangamountInSupplierCurrency='5000',debtchangafterInSupplierCurrency='9108', paySerialNo='25',tagids='' WHERE supplierdebtchangeid = '91';
UPDATE supplier SET  suppliercurrentDebt = '9108',suppliercurrentDebtInCurrency= '9108' , userid = '1', supplierdate = '2026-10-14 18:02:57'   WHERE supplierid = '15';
UPDATE supplier SET  inUse = 0 where supplierid = 15;
UPDATE save SET  savecurrentvalue = '-801200.24',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-796200.24','5000', '1', '1', 'ايصال دفع لمورد', '91', '-801200.24', '2026-10-14 18:02:57', '1',  'supplierPayedDeptController.php','0','','0'); -- id=309
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5000', '5000', '2026-10-14', '1', '0', '0', '2026-10-14 18:02:57','ايصال دفع لمورد ( شركه الصقر اب لايت  ) ','1','0','0','0','91','supplierReportsController.php?do=show&id=91'); -- id=1592
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1592', '467', '5000', '','0'); -- id=1604
UPDATE accountstree SET name = 'شركه الصقر اب لايت ', customName = 'شركه الصقر اب لايت ', customNameEn = 'شركه الصقر اب لايت ', nameEn = 'شركه الصقر اب لايت ', parent = '81', accountNature = '1', theValue = '9108', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 21:45:29' WHERE id = '467';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1592', '383', '5000', '','0'); -- id=1595
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-6186.51', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '14108.00', supplierdebtchangeamount = '5000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '9108.00', supplierdebtchangedate = '2026-10-14 18:02:45', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1592',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='5000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='14108',debtchangamountInSupplierCurrency='5000',debtchangafterInSupplierCurrency='9108', paySerialNo='25',tagids='' WHERE supplierdebtchangeid = '91';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:32:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:02:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 18:02:58', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=4177
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:33:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:03:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 18:03:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=4178
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:33:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:03:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-14 18:03:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=4179
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:41:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:11:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:11:08', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4180
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:41:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:11:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:11:20', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4181

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =496
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(7,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '2800' , clientdate = '2026-10-14 18:11:21', userid = '1' WHERE clientid = '7';
UPDATE client SET  inUse = 0 where clientid = 7;
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 ('7','3800.00','1000','1','ايصال تحصيل (( قبض من عميل ))','496', '2800', '2026-10-14 18:11:09', '1', 'clientPayedDeptController.php', '   ', '1000', '0', null, '0', null, null,'', '-1','1','1','1000','1','','48','0','','.'); -- id=496
UPDATE save SET  savecurrentvalue = '-800200.24',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-801200.24','1000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '496', '-800200.24', '2026-10-14 18:11:21', '1',  'clientPayedDeptController.php','7','','0'); -- id=310
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1000', '1000', '2026-10-14', '1', '0', '0', '2026-10-14 18:11:21','اضافة ايصال سداد للعميل سامي الشربيني','1','0','0','0','496','clientPayedDeptController.php?do=show&id=496'); -- id=1593
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1593', '383', '1000', '','0'); -- id=1605
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-5186.51', 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 ('1593', '434', '1000', '','0'); -- id=1596
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '2800', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
UPDATE clientdebtchange SET clientid = '7', clientdebtchangebefore = '3800.000', clientdebtchangeamount = '1000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '496', clientdebtchangeafter = '2800.000', clientdebtchangedate = '2026-10-14 18:11:09', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '1000.000',discount='', reciptid='0', dailyentryid = '1593',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '496';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:41:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:11:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:11:22', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4182
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:41:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:11:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:11:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4183
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:51:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:21:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-14 18:21:43', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/billsettingsController.php?do=show'); -- id=4184
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:51:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:21:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreportbills.php', '2026-10-14 18:21:59', '1', 'showbills', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/salesreportbills.php?do=showbills'); -- id=4185
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:52:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:22:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:22:27', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=285'); -- id=4186
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 14:52:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:22:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:22:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4187
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-14 18:27:52', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-14','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=65
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('65', '0', '0', '', ''); -- id=65
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 ('65','0','0','0','إضافة عميل جديد','65', '0', '2026-10-14 18:27:52', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=497
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-14 18:27:53'); -- id=498
UPDATE client SET clientname = 'احمد عماد', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-14', 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='498',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 = '65';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:04:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:34:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:34:11', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4188

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfac5d1b01b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(65,@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-14 18:34:12', '06acfac5d1b01b', '65', '0.00', '260', '0', '1', '260.00', '260', '0', '260', '1', '2026-10-14 18:34:12', '', '1', '0', 'احمد عماد', '1', '1', '3', '0', 'احمد عماد', '4' ,'0','','','','','-1','0','0','0','0','0','260','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=294
UPDATE client SET  clientdebt = '260', userid = '1' WHERE clientid = '65';
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 ('65','0.00','260','0','اضافة فاتورة مبيعات','294', '260', '2026-10-14 18:34:13', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '260', '0', null, '0', null, null,'', '0','1','1','260','1','2026-10-14 18:34:12','0','0','',''); -- id=498
UPDATE client SET  inUse = 0 where clientid = 65;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('75','00125', '294', '15', '125', '2', '90', '180', '0', '', '0', '2026-10-14 18:34:13', '125', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','90','180','0','','0','','0','0','0','0'); -- id=2326
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 2326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (125, '2026-10-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '82', userid = '1', storedetaildate = '2026-10-14 18:34:13' WHERE storedetailid = '125';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('125', '1', '2', '1', '294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '84', '82', '1', '2026-10-14 18:34:13','0','0'); -- id=4251
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '294', '22', '79', '2', '40', '80', '0', '', '0', '2026-10-14 18:34:13', '79', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','40','80','0','','0','0.00','0','0','0','0'); -- id=2327
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 = 2327;
 INSERT INTO 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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 18:34:13' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '2', '1', '294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '12', '1', '2026-10-14 18:34:13','0','0'); -- id=4252
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '260', '260', '2026-10-14', '1', '0', '0', '2026-10-14 18:34:14','اضافة فاتورة مبيعات رقم 294','1','0',null,'0','294','sellbillController.php?do=showDetail&sellbillid=294'); -- id=1594
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1594', '498', '260', '','0'); -- id=1606
UPDATE accountstree SET name = 'احمد عماد', customName = 'احمد عماد', customNameEn = 'احمد عماد', nameEn = 'احمد عماد', parent = '58', accountNature = '0', theValue = '260', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1594', '143', '260', '','0'); -- id=1597
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1244451.23', 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 ( '220', '220', '2026-10-14', '1', '0', '0', '2026-10-14 18:34:14','اضافة فاتورة مبيعات رقم 294 - صرف البضاعة من المخزن','1','0',null,'0','294','sellbillController.php?do=showDetail&sellbillid=294'); -- id=1595
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1595', '402', '220', '','0'); -- id=1607
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1113040.78', 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 ('1595', '382', '220', '','0'); -- id=1598
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2345763.66', 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='1594,0,1595' where sellbillid=294;
 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-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+220
                        , returnSellVal = returnSellVal+0, 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 (65, '2026-10-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+220
                        , returnSellVal = returnSellVal+0, 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, 260, 220, 220
                    , 220, 220, 220, 220, 220, 220)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+260, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+220
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+220;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfac5d1b01b and sellbillId = 294 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:04:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:34:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:34:15', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4189
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:04:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:34:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:34:49', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4190
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:35:03', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4191
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:35:15', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4192

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =499
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(65,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-14 18:35:15', userid = '1' WHERE clientid = '65';
UPDATE client SET  inUse = 0 where clientid = 65;
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 ('65','260.00','260','1','ايصال تحصيل (( قبض من عميل ))','499', '0', '2026-10-14 18:35:03', '1', 'clientPayedDeptController.php', '   ', '260', '0', null, '0', null, null,'', '-1','1','1','260','1','','49','0','','.'); -- id=499
UPDATE save SET  savecurrentvalue = '-799940.24',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-800200.24','260', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '499', '-799940.24', '2026-10-14 18:35:15', '1',  'clientPayedDeptController.php','65','','0'); -- id=311
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '260', '260', '2026-10-14', '1', '0', '0', '2026-10-14 18:35:15','اضافة ايصال سداد للعميل احمد عماد','1','0','0','0','499','clientPayedDeptController.php?do=show&id=499'); -- id=1596
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1596', '383', '260', '','0'); -- id=1608
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-4926.51', 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 ('1596', '498', '260', '','0'); -- id=1599
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-14 18:27:53' WHERE id = '498';
UPDATE clientdebtchange SET clientid = '65', clientdebtchangebefore = '260.000', clientdebtchangeamount = '260.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '499', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-14 18:35:03', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '260.000',discount='', reciptid='0', dailyentryid = '1596',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='260',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '499';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:35:16', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4193
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-14 18:35:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4194
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:35:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4195
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:35:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4196
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:35:32', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=294'); -- id=4197
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:35:39', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4198
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 294;
UPDATE sellbill SET  sellbillsysdate = '2026-10-14 18:35:40', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '294';
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 2326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (125, '2026-10-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-180, sellCostBuyPrice =sellCostBuyPrice-150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-180, sellCostBuyPrice =sellCostBuyPrice-150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '84', userid = '1', storedetaildate = '2026-10-14 18:35:40' WHERE storedetailid = '125';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('125', '1', '2', '0', '294', 'تعديل فاتورة مبيعات', 'sellbillController.php', '82', '84', '1', '2026-10-14 18:34:12','0','0'); -- id=4253
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 = 2327;
 INSERT INTO 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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-80, sellCostBuyPrice =sellCostBuyPrice-70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-80, sellCostBuyPrice =sellCostBuyPrice-70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-14 18:35:40' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '2', '0', '294', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '14', '1', '2026-10-14 18:34:12','0','0'); -- id=4254
CALL clientInUse(65,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-260', userid = '1' WHERE clientid = '65';
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 ('65','0.00','260.00','1','تعديل فاتورة مبيعات','294', '-260', '2026-10-14 18:34:12', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '260', '0', null, '0', null, null,'', '0','1','1','260','1','2026-10-14 18:34:12','0','0','',''); -- id=500
UPDATE client SET  inUse = 0 where clientid = 65;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-260, sellCostBuyPrice =sellCostBuyPrice-220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-220
                        , returnSellVal = returnSellVal-0, 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 (65, '2026-10-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-260, sellCostBuyPrice =sellCostBuyPrice-220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-220
                        , returnSellVal = returnSellVal-0, 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, 260, 220, 220
                    , 220, 220, 220, 220, 220, 220)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-260, netSellCostBuyPrice = netSellCostBuyPrice-220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-220
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-220;

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


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

COMMIT;
BEGIN;
CALL clientInUse(65,@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-14 18:34:12', '06acfac5d1b01b', '65', '-260.00', '0', '0', '1', '260', '260', '0', '260', '1', '2026-10-14 18:34:12', '', '1', '0', 'احمد عماد', '1', '1', '3', '0', 'احمد عماد', '4', '294', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-14','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=295
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '65';
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 ('65','-260.00','260','0','اضافة فاتورة مبيعات (معدله)','295', '0', '2026-10-14 18:35:41', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '260', '0', null, '0', null, null,'', '0','1','1','260','1','2026-10-14 18:34:12','0','0','',''); -- id=501
UPDATE client SET  inUse = 0 where clientid = 65;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('75','00125', '295', '15', '125', '2.00', '90', '180', '0', '', '0', '2026-10-14 18:35:41', '125', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','90','180','0','','0','0.00','0','0','0','0'); -- id=2328
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 2328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (125, '2026-10-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '82', userid = '1', storedetaildate = '2026-10-14 18:35:42' WHERE storedetailid = '125';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('125', '1', '2', '1', '295', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '84', '82', '1', '2026-10-14 18:35:42','0','0'); -- id=4255
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '295', '22', '79', '2.00', '40', '80', '0', '', '0', '2026-10-14 18:35:42', '79', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','40','80','0','','0','0.00','0','0','0','0'); -- id=2329
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 = 2329;
 INSERT INTO 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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 80, 70, 70
                    , 70, 70, 70, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 70, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+70
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 18:35:42' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '2', '1', '295', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '14', '12', '1', '2026-10-14 18:35:42','0','0'); -- id=4256
UPDATE dailyentry SET totalcreditor = '260.00', totaldebtor = '260.00', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 18:34:14', entryComment = 'اضافة فاتورة مبيعات رقم 294', fromFlag = '1',related='0',isopeningentry='0',operationId='294',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=294' WHERE id = '1594';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '260.00', '260.00', '2026-10-14', '1', '0', '1594', '2026-10-14 18:35:42','تم عكس القيد رقم 1594 ','1','0','0','0','0',''); -- id=1597
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1597', '498', '260.00', '','0'); -- id=1600
UPDATE accountstree SET name = 'احمد عماد', customName = 'احمد عماد', customNameEn = 'احمد عماد', nameEn = 'احمد عماد', parent = '58', accountNature = '0', theValue = '-260', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1597', '143', '260.00', '','0'); -- id=1609
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1244191.23', 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 = '220.00', totaldebtor = '220.00', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 18:34:14', entryComment = 'اضافة فاتورة مبيعات رقم 294 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='294',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=294' WHERE id = '1595';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '220.00', '220.00', '2026-10-14', '1', '0', '1595', '2026-10-14 18:35:43','تم عكس القيد رقم 1595 ','1','0','0','0','0',''); -- id=1598
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1598', '402', '220.00', '','0'); -- id=1601
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1112820.78', 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 ('1598', '382', '220.00', '','0'); -- id=1610
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2345983.66', 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 ( '260', '260', '2026-10-14', '1', '0', '0', '2026-10-14 18:35:43','اضافة فاتورة مبيعات رقم 295','1','0',null,'0','295','sellbillController.php?do=showDetail&sellbillid=295'); -- id=1599
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1599', '498', '260', '','0'); -- id=1611
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-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1599', '143', '260', '','0'); -- id=1602
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1244451.23', 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 ( '220', '220', '2026-10-14', '1', '0', '0', '2026-10-14 18:35:43','اضافة فاتورة مبيعات رقم 295 - صرف البضاعة من المخزن','1','0',null,'0','295','sellbillController.php?do=showDetail&sellbillid=295'); -- id=1600
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1600', '402', '220', '','0'); -- id=1612
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1113040.78', 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 ('1600', '382', '220', '','0'); -- id=1603
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2345763.66', 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='1599,0,1600' where sellbillid=295;
 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-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+220
                        , returnSellVal = returnSellVal+0, 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 (65, '2026-10-14', 260, 220, 220
                    , 220, 220, 220, 220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,220, 220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+220
                        , returnSellVal = returnSellVal+0, 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, 260, 220, 220
                    , 220, 220, 220, 220, 220, 220)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+260, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+220
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+220;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 294 and newid=295 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:05:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:35:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:35:44', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=295'); -- id=4199
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:06:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:36:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:36:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4200
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:10:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:40:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:40:30', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4201

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfaf8a7be16
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(65,@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-14 18:40:31', '06acfaf8a7be16', '65', '0.00', '4001', '0', '1', '4001.00', '4001', '0', '4001', '1', '2026-10-14 18:40:31', '', '1', '0', 'احمد عماد', '1', '1', '3', '0', 'احمد عماد', '160' ,'0','','','','','-1','0','0','0','0','0','4001','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=296
UPDATE client SET  clientdebt = '4001', userid = '1' WHERE clientid = '65';
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 ('65','0.00','4001','0','اضافة فاتورة مبيعات','296', '4001', '2026-10-14 18:40:31', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4001', '0', null, '0', null, null,'', '0','1','1','4001','1','2026-10-14 18:40:31','0','0','',''); -- id=502
UPDATE client SET  inUse = 0 where clientid = 65;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 36;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.75','00165', '296', '2', '165', '20', '11', '220', '0', '', '0', '2026-10-14 18:40:31', '165', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','36-20,','1','1','0','0','11','220','0','','0','','0','0','0','0'); -- id=2330
UPDATE sellbilldetail SET  lastbuyprice = 8.75 , meanbuyprice = 8.75, lastbuyprice_withDiscount = 8.75, meanbuyprice_withDiscount = 8.75
        , lastbuyprice_withTax = 8.75, meanbuyprice_withTax = 8.75, lastbuyprice_withDiscountAndTax = 8.75
                where sellbilldetailid = 2330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (165, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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 = '80', userid = '1', storedetaildate = '2026-10-14 18:40:32' WHERE storedetailid = '165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '1', '20', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '80', '1', '2026-10-14 18:40:32','0','0'); -- id=4257
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 39;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34','00169', '296', '2', '169', '25', '40', '1000', '0', '', '0', '2026-10-14 18:40:32', '169', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','39-25,','1','1','0','0','40','1000','0','','0','','0','0','0','0'); -- id=2331
UPDATE sellbilldetail SET  lastbuyprice = 34.00 , meanbuyprice = 34.00, lastbuyprice_withDiscount = 34.00, meanbuyprice_withDiscount = 34.00
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where sellbilldetailid = 2331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (169, '2026-10-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1000, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1000, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '185', userid = '1', storedetaildate = '2026-10-14 18:40:32' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '25', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '210', '185', '1', '2026-10-14 18:40:32','0','0'); -- id=4258
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21.5','00168', '296', '2', '168', '25', '25', '625', '0', '', '0', '2026-10-14 18:40:32', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','25','625','0','','0','0.00','0','0','0','0'); -- id=2332
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 2332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-10-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+625, sellCostBuyPrice =sellCostBuyPrice+537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+537.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-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+625, sellCostBuyPrice =sellCostBuyPrice+537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+537.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 = '193', userid = '1', storedetaildate = '2026-10-14 18:40:32' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '25', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '218', '193', '1', '2026-10-14 18:40:32','0','0'); -- id=4259
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '296', '12', '82', '10', '35', '350', '0', '', '0', '2026-10-14 18:40:32', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-10,','1','1','0','0','35','350','0','','0','0.00','0','0','0','0'); -- id=2333
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 = 2333;
 INSERT INTO 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-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '290', userid = '1', storedetaildate = '2026-10-14 18:40:33' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '300', '290', '1', '2026-10-14 18:40:33','0','0'); -- id=4260
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '296', '12', '83', '10', '45', '450', '0', '', '0', '2026-10-14 18:40:33', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-10,','1','1','0','0','45','450','0','','0','0.00','0','0','0','0'); -- id=2334
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 = 2334;
 INSERT INTO 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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '253', userid = '1', storedetaildate = '2026-10-14 18:40:33' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '10', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '263', '253', '1', '2026-10-14 18:40:33','0','0'); -- id=4261
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '296', '20', '190', '30', '15', '450', '0', '', '0', '2026-10-14 18:40:33', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','15','450','0','','0','0.00','0','0','0','0'); -- id=2335
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 = 2335;
 INSERT INTO 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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '166', userid = '1', storedetaildate = '2026-10-14 18:40:33' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '30', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '196', '166', '1', '2026-10-14 18:40:34','0','0'); -- id=4262
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '296', '6', '297', '7', '38', '266', '0', '', '0', '2026-10-14 18:40:34', '297', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','38','266','0','','0','0.00','0','0','0','0'); -- id=2336
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 = 2336;
 INSERT INTO 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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 18:40:34' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '7', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '7', '1', '2026-10-14 18:40:34','0','0'); -- id=4263
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '296', '6', '298', '3', '65', '195', '0', '', '0', '2026-10-14 18:40:34', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','65','195','0','','0','0.00','0','0','0','0'); -- id=2337
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 = 2337;
 INSERT INTO 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-14', 195, 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+195, 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-14', 195, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, 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 = '3', userid = '1', storedetaildate = '2026-10-14 18:40:34' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '3', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '1', '2026-10-14 18:40:34','0','0'); -- id=4264
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16.1','00335', '296', '20', '335', '20', '18', '360', '0', '', '0', '2026-10-14 18:40:34', '335', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18','360','0','','0','0.00','0','0','0','0'); -- id=2338
UPDATE sellbilldetail SET  lastbuyprice = 16.10 , meanbuyprice = 16.10, lastbuyprice_withDiscount = 16.10, meanbuyprice_withDiscount = 16.10
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where sellbilldetailid = 2338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (335, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+322, sellCostMeanBuyPrice = sellCostMeanBuyPrice+322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+322
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+322, sellCostMeanBuyPrice = sellCostMeanBuyPrice+322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+322
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '220', userid = '1', storedetaildate = '2026-10-14 18:40:35' WHERE storedetailid = '335';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('335', '1', '20', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '240', '220', '1', '2026-10-14 18:40:35','0','0'); -- id=4265
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 181;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.28','00296', '296', '6', '296', '10', '8.5', '85', '0', '', '0', '2026-10-14 18:40:35', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','181-10,','1','1','0','0','8.5','85','0','','0','0.00','0','0','0','0'); -- id=2339
UPDATE sellbilldetail SET  lastbuyprice = 7.28 , meanbuyprice = 7.30, lastbuyprice_withDiscount = 7.28, meanbuyprice_withDiscount = 7.30
        , lastbuyprice_withTax = 7.28, meanbuyprice_withTax = 7.3, lastbuyprice_withDiscountAndTax = 7.28
                where sellbilldetailid = 2339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-10-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+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-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '200', userid = '1', storedetaildate = '2026-10-14 18:40:35' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '10', '1', '296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '210', '200', '1', '2026-10-14 18:40:35','0','0'); -- id=4266
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4001', '4001', '2026-10-14', '1', '0', '0', '2026-10-14 18:40:35','اضافة فاتورة مبيعات رقم 296','1','0',null,'0','296','sellbillController.php?do=showDetail&sellbillid=296'); -- id=1601
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1601', '498', '4001', '','0'); -- id=1613
UPDATE accountstree SET name = 'احمد عماد', customName = 'احمد عماد', customNameEn = 'احمد عماد', nameEn = 'احمد عماد', parent = '58', accountNature = '0', theValue = '4001', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1601', '143', '4001', '','0'); -- id=1604
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1248452.23', 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 ( '3476.3', '3476.3', '2026-10-14', '1', '0', '0', '2026-10-14 18:40:35','اضافة فاتورة مبيعات رقم 296 - صرف البضاعة من المخزن','1','0',null,'0','296','sellbillController.php?do=showDetail&sellbillid=296'); -- id=1602
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1602', '402', '3476.3', '','0'); -- id=1614
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1116517.08', 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 ('1602', '382', '3476.3', '','0'); -- id=1605
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2342287.36', 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='1601,0,1602' where sellbillid=296;
 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-14', 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3476.3, 3489.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4001, sellCostBuyPrice =sellCostBuyPrice+3476.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3476.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3489.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3476.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3489.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3476.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3476.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3489.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 (65, '2026-10-14', 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3476.3, 3489.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4001, sellCostBuyPrice =sellCostBuyPrice+3476.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3476.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3489.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3476.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3489.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3476.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3476.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3489.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, 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3, 3476.3, 3489.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4001, netSellCostBuyPrice = netSellCostBuyPrice+3476.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3476.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3489.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3476.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3489.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3476.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3476.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3489.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfaf8a7be16 and sellbillId = 296 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:10:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:40:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:40:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4202
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:20:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:50:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:50:52', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4203
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:20:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:50:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:50:58', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4204
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:21:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:51:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:51:05', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=296'); -- id=4205
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:21:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:51:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:51:36', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4206
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 296;
UPDATE sellbill SET  sellbillsysdate = '2026-10-14 18:51:37', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '296';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 36;
UPDATE sellbilldetail SET  lastbuyprice = 8.75 , meanbuyprice = 8.75, lastbuyprice_withDiscount = 8.75, meanbuyprice_withDiscount = 8.75
        , lastbuyprice_withTax = 8.75, meanbuyprice_withTax = 8.75, lastbuyprice_withDiscountAndTax = 8.75
                where sellbilldetailid = 2330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (165, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, 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-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, 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 = '100', userid = '1', storedetaildate = '2026-10-14 18:51:37' WHERE storedetailid = '165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '1', '20', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '80', '100', '1', '2026-10-14 18:40:31','0','0'); -- id=4267
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 39;
UPDATE sellbilldetail SET  lastbuyprice = 34.00 , meanbuyprice = 34.00, lastbuyprice_withDiscount = 34.00, meanbuyprice_withDiscount = 34.00
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where sellbilldetailid = 2331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (169, '2026-10-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1000, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1000, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '210', userid = '1', storedetaildate = '2026-10-14 18:51:37' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '25', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '185', '210', '1', '2026-10-14 18:40:31','0','0'); -- id=4268
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 2332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-10-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-625, sellCostBuyPrice =sellCostBuyPrice-537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-537.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-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-625, sellCostBuyPrice =sellCostBuyPrice-537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-537.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '218', userid = '1', storedetaildate = '2026-10-14 18:51:37' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '25', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '193', '218', '1', '2026-10-14 18:40:31','0','0'); -- id=4269
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 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 = 2333;
 INSERT INTO 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-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '300', userid = '1', storedetaildate = '2026-10-14 18:51:37' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '290', '300', '1', '2026-10-14 18:40:31','0','0'); -- id=4270
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 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 = 2334;
 INSERT INTO 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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-450, sellCostBuyPrice =sellCostBuyPrice-396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-396, sellCostMeanBuyPrice = sellCostMeanBuyPrice-409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-409
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-450, sellCostBuyPrice =sellCostBuyPrice-396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-396, sellCostMeanBuyPrice = sellCostMeanBuyPrice-409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-409
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '263', userid = '1', storedetaildate = '2026-10-14 18:51:37' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '10', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '253', '263', '1', '2026-10-14 18:40:31','0','0'); -- id=4271
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 = 2335;
 INSERT INTO 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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0,30,0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-450, sellCostBuyPrice =sellCostBuyPrice-390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-390, sellCostMeanBuyPrice = sellCostMeanBuyPrice-390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-390
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-450, sellCostBuyPrice =sellCostBuyPrice-390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-390, sellCostMeanBuyPrice = sellCostMeanBuyPrice-390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-390
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '196', userid = '1', storedetaildate = '2026-10-14 18:51:38' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '30', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '166', '196', '1', '2026-10-14 18:40:31','0','0'); -- id=4272
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 = 2336;
 INSERT INTO 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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-266, sellCostBuyPrice =sellCostBuyPrice-245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-245, sellCostMeanBuyPrice = sellCostMeanBuyPrice-245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-245
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-266, sellCostBuyPrice =sellCostBuyPrice-245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-245, sellCostMeanBuyPrice = sellCostMeanBuyPrice-245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-245
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-14 18:51:38' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '7', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '14', '1', '2026-10-14 18:40:31','0','0'); -- id=4273
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 = 2337;
 INSERT INTO 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-14', 195, 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-195, 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-14', 195, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-195, 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 = '6', userid = '1', storedetaildate = '2026-10-14 18:51:38' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '3', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '6', '1', '2026-10-14 18:40:31','0','0'); -- id=4274
UPDATE sellbilldetail SET  lastbuyprice = 16.10 , meanbuyprice = 16.10, lastbuyprice_withDiscount = 16.10, meanbuyprice_withDiscount = 16.10
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where sellbilldetailid = 2338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (335, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-360, sellCostBuyPrice =sellCostBuyPrice-322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-322, sellCostMeanBuyPrice = sellCostMeanBuyPrice-322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-322
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-360, sellCostBuyPrice =sellCostBuyPrice-322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-322, sellCostMeanBuyPrice = sellCostMeanBuyPrice-322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-322
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '240', userid = '1', storedetaildate = '2026-10-14 18:51:38' WHERE storedetailid = '335';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('335', '1', '20', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '220', '240', '1', '2026-10-14 18:40:31','0','0'); -- id=4275
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 181;
UPDATE sellbilldetail SET  lastbuyprice = 7.28 , meanbuyprice = 7.30, lastbuyprice_withDiscount = 7.28, meanbuyprice_withDiscount = 7.30
        , lastbuyprice_withTax = 7.28, meanbuyprice_withTax = 7.3, lastbuyprice_withDiscountAndTax = 7.28
                where sellbilldetailid = 2339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-10-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-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-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-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-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 = '210', userid = '1', storedetaildate = '2026-10-14 18:51:38' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '10', '0', '296', 'تعديل فاتورة مبيعات', 'sellbillController.php', '200', '210', '1', '2026-10-14 18:40:31','0','0'); -- id=4276
CALL clientInUse(65,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '65';
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 ('65','4001.00','4001.00','1','تعديل فاتورة مبيعات','296', '0', '2026-10-14 18:40:31', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '4001', '0', null, '0', null, null,'', '0','1','1','4001','1','2026-10-14 18:40:31','0','0','',''); -- id=503
UPDATE client SET  inUse = 0 where clientid = 65;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-14', 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3476.3, 3489.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4001, sellCostBuyPrice =sellCostBuyPrice-3476.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3476.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3489.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3476.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3489.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3476.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3476.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3489.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 (65, '2026-10-14', 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3476.3, 3489.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4001, sellCostBuyPrice =sellCostBuyPrice-3476.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3476.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3489.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3476.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3489.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3476.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3476.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3489.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, 4001, 3476.3, 3476.3
                    , 3489.5, 3476.3, 3489.5, 3476.3, 3476.3, 3489.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-4001, netSellCostBuyPrice = netSellCostBuyPrice-3476.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3476.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3489.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3476.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3489.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3476.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3476.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3489.5;

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


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

COMMIT;
BEGIN;
CALL clientInUse(65,@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-14 18:40:31', '06acfaf8a7be16', '65', '0.00', '4321', '0', '1', '4321', '4321', '0', '4321', '1', '2026-10-14 18:40:31', '', '1', '0', 'احمد عماد', '1', '1', '3', '0', 'احمد عماد', '175', '296', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-14','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=297
UPDATE client SET  clientdebt = '4321', userid = '1' WHERE clientid = '65';
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 ('65','0.00','4321','0','اضافة فاتورة مبيعات (معدله)','297', '4321', '2026-10-14 18:51:39', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '4321', '0', null, '0', null, null,'', '0','1','1','4001','1','2026-10-14 18:40:31','0','0','',''); -- id=504
UPDATE client SET  inUse = 0 where clientid = 65;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 36;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.75','00165', '297', '2', '165', '20.00', '11', '220', '0', '', '0', '2026-10-14 18:51:39', '165', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','36-20,','1','1','0','0','11','220','0','','0','0.00','0','0','0','0'); -- id=2340
UPDATE sellbilldetail SET  lastbuyprice = 8.75 , meanbuyprice = 8.75, lastbuyprice_withDiscount = 8.75, meanbuyprice_withDiscount = 8.75
        , lastbuyprice_withTax = 8.75, meanbuyprice_withTax = 8.75, lastbuyprice_withDiscountAndTax = 8.75
                where sellbilldetailid = 2340;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (165, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 220, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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 = '80', userid = '1', storedetaildate = '2026-10-14 18:51:39' WHERE storedetailid = '165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '1', '20', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '80', '1', '2026-10-14 18:51:39','0','0'); -- id=4277
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 39;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34','00169', '297', '2', '169', '25.00', '40', '1000', '0', '', '0', '2026-10-14 18:51:39', '169', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','39-25,','1','1','0','0','40','1000','0','','0','0.00','0','0','0','0'); -- id=2341
UPDATE sellbilldetail SET  lastbuyprice = 34.00 , meanbuyprice = 34.00, lastbuyprice_withDiscount = 34.00, meanbuyprice_withDiscount = 34.00
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where sellbilldetailid = 2341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (169, '2026-10-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1000, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 1000, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1000, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '185', userid = '1', storedetaildate = '2026-10-14 18:51:40' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '25', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '210', '185', '1', '2026-10-14 18:51:40','0','0'); -- id=4278
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21.5','00168', '297', '2', '168', '25.00', '25', '625', '0', '', '0', '2026-10-14 18:51:40', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','25','625','0','','0','0.00','0','0','0','0'); -- id=2342
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 2342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-10-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+625, sellCostBuyPrice =sellCostBuyPrice+537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+537.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-14', 625, 537.5, 537.5
                    , 537.5, 537.5, 537.5, 537.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 537.5, 537.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+625, sellCostBuyPrice =sellCostBuyPrice+537.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+537.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+537.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+537.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+537.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+537.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+537.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+537.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 = '193', userid = '1', storedetaildate = '2026-10-14 18:51:40' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '25', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '218', '193', '1', '2026-10-14 18:51:40','0','0'); -- id=4279
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '297', '12', '82', '10.00', '35', '350', '0', '', '0', '2026-10-14 18:51:40', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-10,','1','1','0','0','35','350','0','','0','0.00','0','0','0','0'); -- id=2343
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 = 2343;
 INSERT INTO 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-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 350, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '290', userid = '1', storedetaildate = '2026-10-14 18:51:40' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '300', '290', '1', '2026-10-14 18:51:40','0','0'); -- id=4280
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '297', '12', '83', '10.00', '45', '450', '0', '', '0', '2026-10-14 18:51:41', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-10,','1','1','0','0','45','450','0','','0','0.00','0','0','0','0'); -- id=2344
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 = 2344;
 INSERT INTO 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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '253', userid = '1', storedetaildate = '2026-10-14 18:51:41' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '10', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '263', '253', '1', '2026-10-14 18:51:41','0','0'); -- id=4281
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '297', '20', '190', '30.00', '15', '450', '0', '', '0', '2026-10-14 18:51:41', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','15','450','0','','0','0.00','0','0','0','0'); -- id=2345
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 = 2345;
 INSERT INTO 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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 450, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '166', userid = '1', storedetaildate = '2026-10-14 18:51:41' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '30', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '196', '166', '1', '2026-10-14 18:51:41','0','0'); -- id=4282
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '297', '6', '297', '7.00', '38', '266', '0', '', '0', '2026-10-14 18:51:41', '297', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','38','266','0','','0','0.00','0','0','0','0'); -- id=2346
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 = 2346;
 INSERT INTO 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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 266, 245, 245
                    , 245, 245, 245, 245
                    , 0, 0, 0, 0
                    , 0, 0, 0, 245, 245, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+245
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+245, sellCostMeanBuyPrice = sellCostMeanBuyPrice+245
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+245, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+245
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+245
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+245
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+245
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 18:51:42' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '7', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '14', '7', '1', '2026-10-14 18:51:42','0','0'); -- id=4283
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '297', '6', '298', '3.00', '65', '195', '0', '', '0', '2026-10-14 18:51:42', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','65','195','0','','0','0.00','0','0','0','0'); -- id=2347
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 = 2347;
 INSERT INTO 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-14', 195, 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+195, 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-14', 195, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, 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 = '3', userid = '1', storedetaildate = '2026-10-14 18:51:42' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '3', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '3', '1', '2026-10-14 18:51:42','0','0'); -- id=4284
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16.1','00335', '297', '20', '335', '20.00', '18', '360', '0', '', '0', '2026-10-14 18:51:42', '335', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18','360','0','','0','0.00','0','0','0','0'); -- id=2348
UPDATE sellbilldetail SET  lastbuyprice = 16.10 , meanbuyprice = 16.10, lastbuyprice_withDiscount = 16.10, meanbuyprice_withDiscount = 16.10
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where sellbilldetailid = 2348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (335, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+322, sellCostMeanBuyPrice = sellCostMeanBuyPrice+322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+322
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 360, 322, 322
                    , 322, 322, 322, 322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 322, 322, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+322
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+322, sellCostMeanBuyPrice = sellCostMeanBuyPrice+322
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+322
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+322
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '220', userid = '1', storedetaildate = '2026-10-14 18:51:42' WHERE storedetailid = '335';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('335', '1', '20', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '240', '220', '1', '2026-10-14 18:51:42','0','0'); -- id=4285
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 181;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.28','00296', '297', '6', '296', '10.00', '8.5', '85', '0', '', '0', '2026-10-14 18:51:42', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','181-10,','1','1','0','0','8.5','85','0','','0','0.00','0','0','0','0'); -- id=2349
UPDATE sellbilldetail SET  lastbuyprice = 7.28 , meanbuyprice = 7.30, lastbuyprice_withDiscount = 7.28, meanbuyprice_withDiscount = 7.30
        , lastbuyprice_withTax = 7.28, meanbuyprice_withTax = 7.3, lastbuyprice_withDiscountAndTax = 7.28
                where sellbilldetailid = 2349;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-10-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+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-14', 85, 72.8, 72.8
                    , 73, 72.8, 73, 72.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72.8, 73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+72.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '200', userid = '1', storedetaildate = '2026-10-14 18:51:43' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '10', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '210', '200', '1', '2026-10-14 18:51:43','0','0'); -- id=4286
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', '297', '24', '291', '5', '27', '135', '0', '', '0', '2026-10-14 18:51:43', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','99-5,','1','1','0','0','27','135','0','','0','0.00','0','0','0','0'); -- id=2350
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 = 2350;
 INSERT INTO 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-14', 135, 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+135, 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-14', 135, 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+135, 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 = '109', userid = '1', storedetaildate = '2026-10-14 18:51:43' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '5', '1', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '114', '109', '1', '2026-10-14 18:51:43','0','0'); -- id=4287
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '297', '14', '81', '10', '18.5', '185', '0', '', '0', '2026-10-14 18:51:43', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','185','0','','0','0.00','0','0','0','0'); -- id=2351
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 = 2351;
 INSERT INTO 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-14', 185, 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+185, 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-14', 185, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+185, 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 = '102', userid = '1', storedetaildate = '2026-10-14 18:51: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', '297', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '112', '102', '1', '2026-10-14 18:51:43','0','0'); -- id=4288
UPDATE dailyentry SET totalcreditor = '4001.00', totaldebtor = '4001.00', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 18:40:35', entryComment = 'اضافة فاتورة مبيعات رقم 296', fromFlag = '1',related='0',isopeningentry='0',operationId='296',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=296' WHERE id = '1601';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4001.00', '4001.00', '2026-10-14', '1', '0', '1601', '2026-10-14 18:51:43','تم عكس القيد رقم 1601 ','1','0','0','0','0',''); -- id=1603
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1603', '498', '4001.00', '','0'); -- id=1606
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-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1603', '143', '4001.00', '','0'); -- id=1615
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1244451.23', 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 = '3476.30', totaldebtor = '3476.30', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 18:40:35', entryComment = 'اضافة فاتورة مبيعات رقم 296 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='296',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=296' WHERE id = '1602';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3476.30', '3476.30', '2026-10-14', '1', '0', '1602', '2026-10-14 18:51:44','تم عكس القيد رقم 1602 ','1','0','0','0','0',''); -- id=1604
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1604', '402', '3476.30', '','0'); -- id=1607
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1113040.78', 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 ('1604', '382', '3476.30', '','0'); -- id=1616
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2345763.66', 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 ( '4321', '4321', '2026-10-14', '1', '0', '0', '2026-10-14 18:51:44','اضافة فاتورة مبيعات رقم 297','1','0',null,'0','297','sellbillController.php?do=showDetail&sellbillid=297'); -- id=1605
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1605', '498', '4321', '','0'); -- id=1617
UPDATE accountstree SET name = 'احمد عماد', customName = 'احمد عماد', customNameEn = 'احمد عماد', nameEn = 'احمد عماد', parent = '58', accountNature = '0', theValue = '4321', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 18:27:53' WHERE id = '498';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1605', '143', '4321', '','0'); -- id=1608
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1248772.23', 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 ( '3784.3', '3784.3', '2026-10-14', '1', '0', '0', '2026-10-14 18:51:44','اضافة فاتورة مبيعات رقم 297 - صرف البضاعة من المخزن','1','0',null,'0','297','sellbillController.php?do=showDetail&sellbillid=297'); -- id=1606
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1606', '402', '3784.3', '','0'); -- id=1618
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1116825.08', 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 ('1606', '382', '3784.3', '','0'); -- id=1609
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2341979.36', 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='1605,0,1606' where sellbillid=297;
 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-14', 4321, 3784.3, 3784.3
                    , 3795.55, 3784.3, 3795.55, 3782
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3784.3, 3795.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4321, sellCostBuyPrice =sellCostBuyPrice+3784.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3784.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3795.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3784.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3795.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3782
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3784.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3795.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 (65, '2026-10-14', 4321, 3784.3, 3784.3
                    , 3795.55, 3784.3, 3795.55, 3782
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3784.3, 3795.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4321, sellCostBuyPrice =sellCostBuyPrice+3784.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3784.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3795.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3784.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3795.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3782
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3784.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3795.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, 4321, 3784.3, 3784.3
                    , 3795.55, 3784.3, 3795.55, 3782, 3784.3, 3795.55)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4321, netSellCostBuyPrice = netSellCostBuyPrice+3784.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3784.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3795.55
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3784.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3795.55
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3782
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3784.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3795.55;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 296 and newid=297 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 15:21:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 18:51:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 18:51:46', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=297'); -- id=4207
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:16:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 19:46:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 19:46:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4208
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:18:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 19:48:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 19:48:35', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4209

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfbff7ed45f
-- ----------------------------------------------------------------------------------------------------

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-14 19:48:35', '06acfbff7ed45f', '1', '0.00', '0', '0', '1', '1317.50', '1317.5', '1317.5', '0', '1', '2026-10-14 19:48:35', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '40' ,'0','','','','','-1','0','0','0','0','0','1317','0','','0','0','1317.5','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=298
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','اضافة فاتورة مبيعات','298', '0', '2026-10-14 19:48:36', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1317.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 19:48:35','0','0','',''); -- id=505
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '298', '3', '107', '2', '103', '206', '0', '', '1', '2026-10-14 19:48:36', '107', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','23-2,','1','1','0','0','103','206','0','','0','0.00','0','0','0','0'); -- id=2352
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 = 2352;
 INSERT INTO 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-14', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '85', userid = '1', storedetaildate = '2026-10-14 19:48:36' WHERE storedetailid = '107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '1', '2', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '85', '1', '2026-10-14 19:48:36','0','0'); -- id=4289
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 181;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.28','00296', '298', '6', '296', '2', '9', '18', '0', '', '1', '2026-10-14 19:48:36', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','181-2,','1','1','0','0','9','18','0','','0','0.00','0','0','0','0'); -- id=2353
UPDATE sellbilldetail SET  lastbuyprice = 7.28 , meanbuyprice = 7.30, lastbuyprice_withDiscount = 7.28, meanbuyprice_withDiscount = 7.30
        , lastbuyprice_withTax = 7.28, meanbuyprice_withTax = 7.3, lastbuyprice_withDiscountAndTax = 7.28
                where sellbilldetailid = 2353;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-10-14', 18, 14.56, 14.56
                    , 14.6, 14.56, 14.6, 14.56
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 14.56, 14.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18, sellCostBuyPrice =sellCostBuyPrice+14.56
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14.56, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14.56, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14.56
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 18, 14.56, 14.56
                    , 14.6, 14.56, 14.6, 14.56
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14.56, 14.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18, sellCostBuyPrice =sellCostBuyPrice+14.56
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14.56, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14.56, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14.56
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14.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 = '198', userid = '1', storedetaildate = '2026-10-14 19:48:37' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '2', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '200', '198', '1', '2026-10-14 19:48:37','0','0'); -- id=4290
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '298', '3', '102', '2', '12', '24', '0', '', '1', '2026-10-14 19:48:37', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','24','0','','0','0.00','0','0','0','0'); -- id=2354
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 = 2354;
 INSERT INTO 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-14', 24, 23.5, 23.5
                    , 23.5, 23.5, 23.5, 23.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 23.5, 23.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+23.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 24, 23.5, 23.5
                    , 23.5, 23.5, 23.5, 23.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23.5, 23.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+23.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '704', userid = '1', storedetaildate = '2026-10-14 19:48:37' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '2', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '706', '704', '1', '2026-10-14 19:48:37','0','0'); -- id=4291
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00104', '298', '3', '104', '2', '15.75', '31.5', '0', '', '1', '2026-10-14 19:48:37', '104', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15.75','31.5','0','','0','0.00','0','0','0','0'); -- id=2355
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 2355;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (104, '2026-10-14', 31.5, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31.5, sellCostBuyPrice =sellCostBuyPrice+30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 31.5, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31.5, sellCostBuyPrice =sellCostBuyPrice+30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '284', userid = '1', storedetaildate = '2026-10-14 19:48:37' WHERE storedetailid = '104';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('104', '1', '2', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '286', '284', '1', '2026-10-14 19:48:37','0','0'); -- id=4292
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '298', '3', '103', '4', '5.5', '22', '0', '', '1', '2026-10-14 19:48:38', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-4,','1','1','0','0','5.5','22','0','','0','0.00','0','0','0','0'); -- id=2356
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 = 2356;
 INSERT INTO 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-14', 22, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 22, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1128', userid = '1', storedetaildate = '2026-10-14 19:48:38' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '4', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1132', '1128', '1', '2026-10-14 19:48:38','0','0'); -- id=4293
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '298', '6', '529', '12', '26', '312', '0', '', '1', '2026-10-14 19:48:38', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','312','0','','0','0.00','0','0','0','0'); -- id=2357
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 2357;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-10-14', 312, 276, 276
                    , 276, 276, 276, 276
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 276, 276, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+276
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+276, sellCostMeanBuyPrice = sellCostMeanBuyPrice+276
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+276, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+276
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+276
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+276
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+276
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 312, 276, 276
                    , 276, 276, 276, 276
                    , 0, 0, 0, 0
                    , 0, 0, 0, 276, 276, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+276
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+276, sellCostMeanBuyPrice = sellCostMeanBuyPrice+276
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+276, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+276
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+276
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+276
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+276
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2026-10-14 19:48:38' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '12', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '74', '62', '1', '2026-10-14 19:48:38','0','0'); -- id=4294
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('40','00370', '298', '10', '370', '16', '44', '704', '0', '', '1', '2026-10-14 19:48:38', '370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','44','704','0','','0','0.00','0','0','0','0'); -- id=2358
UPDATE sellbilldetail SET  lastbuyprice = 40.00 , meanbuyprice = 40.00, lastbuyprice_withDiscount = 40.00, meanbuyprice_withDiscount = 40.00
        , lastbuyprice_withTax = 40, meanbuyprice_withTax = 40, lastbuyprice_withDiscountAndTax = 40
                where sellbilldetailid = 2358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (370, '2026-10-14', 704, 640, 640
                    , 640, 640, 640, 640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 640, 640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+704, sellCostBuyPrice =sellCostBuyPrice+640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 704, 640, 640
                    , 640, 640, 640, 640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640, 640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+704, sellCostBuyPrice =sellCostBuyPrice+640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 19:48:39' WHERE storedetailid = '370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('370', '1', '16', '1', '298', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '-15', '1', '2026-10-14 19:48:39','0','0'); -- id=4295
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-798622.75',  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 ('-799940.25','1317.5', '0', '1', 'اضافة فاتورة مبيعات', '298', '-798622.75', '2026-10-14 19:48:39', '1',  'sellbillController.php','1','','0'); -- id=312
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1317.5', '1317.5', '2026-10-14', '1', '0', '0', '2026-10-14 19:48:39','اضافة فاتورة مبيعات رقم 298','1','0',null,'0','298','sellbillController.php?do=showDetail&sellbillid=298'); -- id=1607
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1607', '383', '1317.5', '','0'); -- id=1619
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-3609.01', 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 ('1607', '143', '1317.5', '','0'); -- id=1610
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1250089.73', 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 ( '1204.06', '1204.06', '2026-10-14', '1', '0', '0', '2026-10-14 19:48:39','اضافة فاتورة مبيعات رقم 298 - صرف البضاعة من المخزن','1','0',null,'0','298','sellbillController.php?do=showDetail&sellbillid=298'); -- id=1608
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1608', '402', '1204.06', '','0'); -- id=1620
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1118029.14', 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 ('1608', '382', '1204.06', '','0'); -- id=1611
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2340775.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='1607,0,1608' where sellbillid=298;
 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-14', 1317.5, 1204.06, 1204.06
                    , 1204.1, 1204.06, 1204.1, 1204.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1204.06, 1204.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1317.5, sellCostBuyPrice =sellCostBuyPrice+1204.06
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1204.06, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1204.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1204.06, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1204.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1204.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1204.06
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1204.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 1317.5, 1204.06, 1204.06
                    , 1204.1, 1204.06, 1204.1, 1204.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1204.06, 1204.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1317.5, sellCostBuyPrice =sellCostBuyPrice+1204.06
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1204.06, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1204.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1204.06, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1204.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1204.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1204.06
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1204.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1317.5, 1204.06, 1204.06
                    , 1204.1, 1204.06, 1204.1, 1204.06, 1204.06, 1204.1)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1317.5, netSellCostBuyPrice = netSellCostBuyPrice+1204.06
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1204.06
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1204.1
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1204.06
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1204.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1204.06
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1204.06
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1204.1;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfbff7ed45f and sellbillId = 298 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:18:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 19:48:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 19:48:40', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4210
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:27:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 19:57:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 19:57:25', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4211

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfc0797591b
-- ----------------------------------------------------------------------------------------------------

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-14 19:57:26', '06acfc0797591b', '1', '0.00', '0', '0', '1', '680.00', '680', '680', '0', '1', '2026-10-14 19:57:26', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','680','0','','0','0','680','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=299
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','اضافة فاتورة مبيعات','299', '0', '2026-10-14 19:57:26', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '680', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-14 19:57:26','0','0','',''); -- id=506
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '299', '20', '182', '10', '48', '480', '0', '', '1', '2026-10-14 19:57:27', '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=2359
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 = 2359;
 INSERT INTO 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-14', 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-14', 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 = '832', userid = '1', storedetaildate = '2026-10-14 19:57:27' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '10', '1', '299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '842', '832', '1', '2026-10-14 19:57:27','0','0'); -- id=4296
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '299', '20', '181', '5', '40', '200', '0', '', '1', '2026-10-14 19:57:27', '181', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','40','200','0','','0','0.00','0','0','0','0'); -- id=2360
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 = 2360;
 INSERT INTO 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-14', 200, 164.75, 164.75
                    , 164.75, 164.75, 164.75, 164.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 164.75, 164.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+164.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+164.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+164.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+164.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+164.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+164.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+164.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+164.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 200, 164.75, 164.75
                    , 164.75, 164.75, 164.75, 164.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 164.75, 164.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+164.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+164.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+164.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+164.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+164.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+164.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+164.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+164.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 = '12', userid = '1', storedetaildate = '2026-10-14 19:57:27' WHERE storedetailid = '181';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '1', '5', '1', '299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '12', '1', '2026-10-14 19:57:27','0','0'); -- id=4297
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-797942.75',  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 ('-798622.75','680', '0', '1', 'اضافة فاتورة مبيعات', '299', '-797942.75', '2026-10-14 19:57:27', '1',  'sellbillController.php','1','','0'); -- id=313
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '680', '680', '2026-10-14', '1', '0', '0', '2026-10-14 19:57:28','اضافة فاتورة مبيعات رقم 299','1','0',null,'0','299','sellbillController.php?do=showDetail&sellbillid=299'); -- id=1609
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1609', '383', '680', '','0'); -- id=1621
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-2929.01', 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 ('1609', '143', '680', '','0'); -- id=1612
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1250769.73', 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 ( '591.95', '591.95', '2026-10-14', '1', '0', '0', '2026-10-14 19:57:28','اضافة فاتورة مبيعات رقم 299 - صرف البضاعة من المخزن','1','0',null,'0','299','sellbillController.php?do=showDetail&sellbillid=299'); -- id=1610
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1610', '402', '591.95', '','0'); -- id=1622
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1118621.09', 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 ('1610', '382', '591.95', '','0'); -- id=1613
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2340183.35', 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='1609,0,1610' where sellbillid=299;
 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-14', 680, 591.95, 591.95
                    , 591.95, 591.95, 591.95, 591.95
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,591.95, 591.95, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+591.95
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+591.95, sellCostMeanBuyPrice = sellCostMeanBuyPrice+591.95
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+591.95, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+591.95
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+591.95
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+591.95
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+591.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;
 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-14', 680, 591.95, 591.95
                    , 591.95, 591.95, 591.95, 591.95
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,591.95, 591.95, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+591.95
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+591.95, sellCostMeanBuyPrice = sellCostMeanBuyPrice+591.95
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+591.95, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+591.95
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+591.95
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+591.95
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+591.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 680, 591.95, 591.95
                    , 591.95, 591.95, 591.95, 591.95, 591.95, 591.95)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+680, netSellCostBuyPrice = netSellCostBuyPrice+591.95
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+591.95
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+591.95
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+591.95
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+591.95
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+591.95
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+591.95
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+591.95;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfc0797591b and sellbillId = 299 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:27:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 19:57:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 19:57:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4212
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:33:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:03:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 20:03:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4213
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:33:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:03:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-14 20:03:10', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4214
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:33:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:03:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:03:16', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=168'); -- id=4215
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:35:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:05:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:05:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:39:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:09:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 20:09:40', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4217
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:40:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:10:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 20:10:15', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4218
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','190','255','275','255','2026-10-14','0','1','0','','0','0','0','0','0','190','190','190','190','190','0','34.21','34.21','44.74','.','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=596
UPDATE product SET productName = 'لفه بروفايل ابيض افينا', productDescription = '', productCatId = '6', productBuyPrice = '190', productSellAllPrice = '255', productSellUnitPrice = '275', productSellHalfPrice = '255', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00596',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 = '34.21' , buyhalf_precentage = '34.21' , buypart_precentage = '44.74',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 = '596';
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', '596', '1.00', '2026-10-14', '1', '0','0059601','255','255','275','190','','0','0','0','0','0','0','0','0','0','0'); -- id=596
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('596', '1', '1', '1', '2026-10-14'); -- id=596
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('596', '1', '1', '0', '596', 'إضافة منتج', 'productController.php', '0', '1', '1', '2026-10-14','0','0'); -- id=4298
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (596, 1,'2026-10-14 20:10:16',1)
                ON DUPLICATE KEY UPDATE productid = 596, edited = 1, sysdate = '2026-10-14 20:10:16', userid = 1; -- id=756
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '190', '190', '2026-10-14', '1', '0', '0', '2026-10-14 20:10:16','إضافة منتج لفه بروفايل ابيض افينا الكمية 1','1','0','0','0','596','productController.php?do=edit&id=596'); -- id=1611
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1611', '382', '190', '','0'); -- id=1623
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2340373.35', 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 ('1611', '121', '190', '','0'); -- id=1614
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1832554.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';
UPDATE product SET productName = 'لفه بروفايل ابيض افينا', productDescription = '', productCatId = '6', productBuyPrice = '190.00', productSellAllPrice = '255.00', productSellUnitPrice = '275.00', productSellHalfPrice = '255.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00596',type ='0', expireDate = '0' , dailyentryId = '1611',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '34.21' , buyhalf_precentage = '34.21' , buypart_precentage = '44.74',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 = '596';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:40:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:10:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-14 20:10:19', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4219
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:41:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:11:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:11:12', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4220

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfc45573e4e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(39,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-14 20:11:13', '06acfc45573e4e', '39', '0.00', '588', '0', '1', '588.00', '588', '0', '588', '1', '2026-10-14 20:11:13', '', '1', '0', 'محمد عباس الطوخي', '1', '1', '3', '0', 'محمد عباس الطوخي', '7' ,'0','','','','','-1','0','0','0','0','0','588','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=300
UPDATE client SET  clientdebt = '588', userid = '1' WHERE clientid = '39';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('39','0.00','588','0','اضافة فاتورة مبيعات','300', '588', '2026-10-14 20:11:13', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '588', '0', null, '0', null, null,'', '0','1','1','588','1','2026-10-14 20:11:13','0','0','',''); -- id=507
UPDATE client SET  inUse = 0 where clientid = 39;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('41','00411', '300', '6', '411', '2', '50', '100', '0', '', '1', '2026-10-14 20:11:13', '411', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','50','100','0','','0','0.00','0','0','0','0'); -- id=2361
UPDATE sellbilldetail SET  lastbuyprice = 41.00 , meanbuyprice = 41.00, lastbuyprice_withDiscount = 41.00, meanbuyprice_withDiscount = 41.00
        , lastbuyprice_withTax = 41, meanbuyprice_withTax = 41, lastbuyprice_withDiscountAndTax = 41
                where sellbilldetailid = 2361;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (411, '2026-10-14', 100, 82, 82
                    , 82, 82, 82, 82
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 82, 82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, sellCostBuyPrice =sellCostBuyPrice+82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-14', 100, 82, 82
                    , 82, 82, 82, 82
                    , 0, 0, 0, 0
                    , 0, 0, 0, 82, 82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, sellCostBuyPrice =sellCostBuyPrice+82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-14 20:11:14' WHERE storedetailid = '411';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('411', '1', '2', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '7', '1', '2026-10-14 20:11:14','0','0'); -- id=4299
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50','00412', '300', '6', '412', '1', '60', '60', '0', '', '1', '2026-10-14 20:11:14', '412', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','60','60','0','','0','0.00','0','0','0','0'); -- id=2362
UPDATE sellbilldetail SET  lastbuyprice = 50.00 , meanbuyprice = 50.00, lastbuyprice_withDiscount = 50.00, meanbuyprice_withDiscount = 50.00
        , lastbuyprice_withTax = 50, meanbuyprice_withTax = 50, lastbuyprice_withDiscountAndTax = 50
                where sellbilldetailid = 2362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (412, '2026-10-14', 60, 50, 50
                    , 50, 50, 50, 50
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 50, 50, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+50
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+50, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+50, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+50
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 60, 50, 50
                    , 50, 50, 50, 50
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 50, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+50
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+50, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+50, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+50
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 20:11:14' WHERE storedetailid = '412';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('412', '1', '1', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-10-14 20:11:14','0','0'); -- id=4300
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21','00409', '300', '6', '409', '2', '30', '60', '0', '', '1', '2026-10-14 20:11:14', '409', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30','60','0','','0','0.00','0','0','0','0'); -- id=2363
UPDATE sellbilldetail SET  lastbuyprice = 21.00 , meanbuyprice = 21.00, lastbuyprice_withDiscount = 21.00, meanbuyprice_withDiscount = 21.00
        , lastbuyprice_withTax = 21, meanbuyprice_withTax = 21, lastbuyprice_withDiscountAndTax = 21
                where sellbilldetailid = 2363;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (409, '2026-10-14', 60, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 60, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-14 20:11:15' WHERE storedetailid = '409';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('409', '1', '2', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '6', '1', '2026-10-14 20:11:15','0','0'); -- id=4301
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '300', '7', '387', '1', '93', '93', '0', '', '1', '2026-10-14 20:11:15', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','93','93','0','','0','0.00','0','0','0','0'); -- id=2364
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 2364;
 INSERT INTO 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-14', 93, 80, 80
                    , 80.58, 80, 80.58, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 80, 80.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80.58
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 93, 80, 80
                    , 80.58, 80, 80.58, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80.58
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-14 20:11:15' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '1', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '31', '1', '2026-10-14 20:11:15','0','0'); -- id=4302
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('190','00596', '300', '6', '596', '1', '275', '275', '0', '', '1', '2026-10-14 20:11:15', '596', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','275','275','0','','0','0.00','0','0','0','0'); -- id=2365
UPDATE sellbilldetail SET  lastbuyprice = 190.00 , meanbuyprice = 190.00, lastbuyprice_withDiscount = 190.00, meanbuyprice_withDiscount = 190.00
        , lastbuyprice_withTax = 190, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 190
                where sellbilldetailid = 2365;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (596, '2026-10-14', 275, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 275, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-14 20:11:15' WHERE storedetailid = '596';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('596', '1', '1', '1', '300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-14 20:11:15','0','0'); -- id=4303
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '588', '588', '2026-10-14', '1', '0', '0', '2026-10-14 20:11:15','اضافة فاتورة مبيعات رقم 300','1','0',null,'0','300','sellbillController.php?do=showDetail&sellbillid=300'); -- id=1612
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1612', '471', '588', '','0'); -- id=1624
UPDATE accountstree SET name = 'محمد عباس الطوخي', customName = 'محمد عباس الطوخي', customNameEn = 'محمد عباس الطوخي', nameEn = 'محمد عباس الطوخي', parent = '58', accountNature = '0', theValue = '588', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 19:10:39' WHERE id = '471';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1612', '143', '588', '','0'); -- id=1615
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1251357.73', 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 ( '444', '444', '2026-10-14', '1', '0', '0', '2026-10-14 20:11:15','اضافة فاتورة مبيعات رقم 300 - صرف البضاعة من المخزن','1','0',null,'0','300','sellbillController.php?do=showDetail&sellbillid=300'); -- id=1613
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1613', '402', '444', '','0'); -- id=1625
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1119065.09', 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 ('1613', '382', '444', '','0'); -- id=1616
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2339929.35', 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='1612,0,1613' where sellbillid=300;
 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-14', 588, 444, 444
                    , 444.58, 444, 444.58, 444
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,444, 444.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+588, sellCostBuyPrice =sellCostBuyPrice+444
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+444, sellCostMeanBuyPrice = sellCostMeanBuyPrice+444.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+444, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+444.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+444
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+444
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+444.58
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (39, '2026-10-14', 588, 444, 444
                    , 444.58, 444, 444.58, 444
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,444, 444.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+588, sellCostBuyPrice =sellCostBuyPrice+444
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+444, sellCostMeanBuyPrice = sellCostMeanBuyPrice+444.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+444, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+444.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+444
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+444
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+444.58
                        , returnSellVal = returnSellVal+0, 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, 588, 444, 444
                    , 444.58, 444, 444.58, 444, 444, 444.58)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+588, netSellCostBuyPrice = netSellCostBuyPrice+444
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+444
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+444.58
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+444
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+444.58
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+444
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+444
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+444.58;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfc45573e4e and sellbillId = 300 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:41:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:11:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:11:17', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4221
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:41:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:11:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:11:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:44:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:14:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:14:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4223
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:57:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:27:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:27:49', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4224

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06acfc672aa000
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(24,@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-14 20:27:50', '06acfc672aa000', '24', '4036.00', '22553.39', '2', '2', '18895.30', '18517.39', '0', '18517.39', '1', '2026-10-14 20:27:50', '', '1', '0', 'وليد الهنداوي', '1', '1', '3', '0', '24 - وليد الهنداوي', '466' ,'0','','','','','-1','0','0','0','0','0','18517','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-14','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=301
UPDATE client SET  clientdebt = '22553.39', userid = '1' WHERE clientid = '24';
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 ('24','4036.00','18517.39','0','اضافة فاتورة مبيعات','301', '22553.39', '2026-10-14 20:27:50', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '18517.39', '0', null, '0', null, null,'', '0','1','1','18517.39','1','2026-10-14 20:27:50','0','0','',''); -- id=508
UPDATE client SET  inUse = 0 where clientid = 24;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+108 where id = 121;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '301', '1', '42', '108', '30.75', '3321', '0', '', '1', '2026-10-14 20:27:51', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','121-108,','1','1','0','0','30.75','3321','0','','0','0.00','0','0','0','0'); -- id=2366
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.579296968, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+108
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.579296968, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '800', userid = '1', storedetaildate = '2026-10-14 20:27:51' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '108', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '908', '800', '1', '2026-10-14 20:27:51','0','0'); -- id=4304
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+108 where id = 127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '301', '1', '43', '108', '30.75', '3321', '0', '', '1', '2026-10-14 20:27:51', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','127-108,','1','1','0','0','30.75','3321','0','','0','0.00','0','0','0','0'); -- id=2367
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.579296968, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+108
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.579296968, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '762', userid = '1', storedetaildate = '2026-10-14 20:27:51' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '108', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '870', '762', '1', '2026-10-14 20:27:51','0','0'); -- id=4305
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 120;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '301', '1', '41', '100', '46', '4600', '0', '', '1', '2026-10-14 20:27:51', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','120-100,','1','1','0','0','46','4600','0','','0','0.00','0','0','0','0'); -- id=2368
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 2368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-14', 4507.9990262129, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4507.9990262129, sellCostBuyPrice =sellCostBuyPrice+4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4433
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 4507.9990262129, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4507.9990262129, sellCostBuyPrice =sellCostBuyPrice+4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4433
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '554', userid = '1', storedetaildate = '2026-10-14 20:27:52' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '100', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '654', '554', '1', '2026-10-14 20:27:52','0','0'); -- id=4306
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 128;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.44','00044', '301', '1', '44', '100', '8.8', '880.0000000000001', '0', '', '1', '2026-10-14 20:27:52', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','128-100,','1','1','0','0','8.8','880','0','','0','0.00','0','0','0','0'); -- id=2369
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 2369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-10-14', 862.39981371029, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+862.39981371029, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 862.39981371029, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+862.39981371029, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1651', userid = '1', storedetaildate = '2026-10-14 20:27:52' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '100', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1751', '1651', '1', '2026-10-14 20:27:52','0','0'); -- id=4307
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '301', '1', '9', '8', '319', '2552', '0', '', '1', '2026-10-14 20:27:52', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-8,','1','1','0','0','319','2552','0','','0','0.00','0','0','0','0'); -- id=2370
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 = 2370;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-14', 2500.9594597598, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2500.9594597598, sellCostBuyPrice =sellCostBuyPrice+2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2448
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 2500.9594597598, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2500.9594597598, sellCostBuyPrice =sellCostBuyPrice+2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2448
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '211', userid = '1', storedetaildate = '2026-10-14 20:27:52' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '8', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '219', '211', '1', '2026-10-14 20:27:52','0','0'); -- id=4308
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 122;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50.67','00053', '301', '1', '53', '6', '53', '318', '0', '', '1', '2026-10-14 20:27:53', '53', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','122-6,','1','1','0','0','53','318','0','','0','0.00','0','0','0','0'); -- id=2371
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 2371;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-10-14', 311.63993268167, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+311.63993268167, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 311.63993268167, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+311.63993268167, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '119', userid = '1', storedetaildate = '2026-10-14 20:27:53' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '125', '119', '1', '2026-10-14 20:27:53','0','0'); -- id=4309
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237.5','00045', '301', '1', '45', '8', '246.5', '1972', '0', '', '1', '2026-10-14 20:27:53', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','131-8,','1','1','0','0','246.5','1972','0','','0','0.00','0','0','0','0'); -- id=2372
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 2372;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-10-14', 1932.5595825417, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1932.5595825417, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 1932.5595825417, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1932.5595825417, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2026-10-14 20:27:53' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '8', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '124', '116', '1', '2026-10-14 20:27:53','0','0'); -- id=4310
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 126;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('36.95','00051', '301', '1', '51', '5', '38.7', '193.5', '0', '', '1', '2026-10-14 20:27:53', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','126-5,','1','1','0','0','38.7','193.5','0','','0','0.00','0','0','0','0'); -- id=2373
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 2373;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-10-14', 189.62995903743, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.62995903743, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 189.62995903743, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.62995903743, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '152', userid = '1', storedetaildate = '2026-10-14 20:27:54' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '157', '152', '1', '2026-10-14 20:27:54','0','0'); -- id=4311
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('68.63','00052', '301', '1', '52', '5', '72', '360', '0', '', '1', '2026-10-14 20:27:54', '52', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','72','360','0','','0','0.00','0','0','0','0'); -- id=2374
UPDATE sellbilldetail SET  lastbuyprice = 68.63 , meanbuyprice = 68.63, lastbuyprice_withDiscount = 68.63, meanbuyprice_withDiscount = 68.63
        , lastbuyprice_withTax = 68.63, meanbuyprice_withTax = 68.63, lastbuyprice_withDiscountAndTax = 68.63
                where sellbilldetailid = 2374;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (52, '2026-10-14', 352.79992379057, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.79992379057, sellCostBuyPrice =sellCostBuyPrice+343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 352.79992379057, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.79992379057, sellCostBuyPrice =sellCostBuyPrice+343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '126', userid = '1', storedetaildate = '2026-10-14 20:27:54' WHERE storedetailid = '52';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '1', '5', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '131', '126', '1', '2026-10-14 20:27:54','0','0'); -- id=4312
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 129;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00048', '301', '1', '48', '6', '55.5', '333', '0', '', '1', '2026-10-14 20:27:54', '48', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','129-6,','1','1','0','0','55.5','333','0','','0','0.00','0','0','0','0'); -- id=2375
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 2375;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-14', 326.33992950628, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+326.33992950628, sellCostBuyPrice =sellCostBuyPrice+316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 326.33992950628, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+326.33992950628, sellCostBuyPrice =sellCostBuyPrice+316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-10-14 20:27:54' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '6', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '185', '179', '1', '2026-10-14 20:27:54','0','0'); -- id=4313
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 125;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '301', '1', '47', '4', '95', '380', '0', '', '1', '2026-10-14 20:27:54', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','125-4,','1','1','0','0','95','380','0','','0','0.00','0','0','0','0'); -- id=2376
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-14', 372.39991955672, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+372.39991955672, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 372.39991955672, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+372.39991955672, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '1', storedetaildate = '2026-10-14 20:27:55' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '4', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '145', '141', '1', '2026-10-14 20:27:55','0','0'); -- id=4314
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('79.18','00054', '301', '1', '54', '8', '83.1', '664.8', '0', '', '1', '2026-10-14 20:27:55', '54', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','83.1','664.8','0','','0','0.00','0','0','0','0'); -- id=2377
UPDATE sellbilldetail SET  lastbuyprice = 79.18 , meanbuyprice = 79.18, lastbuyprice_withDiscount = 79.18, meanbuyprice_withDiscount = 79.18
        , lastbuyprice_withTax = 79.18, meanbuyprice_withTax = 79.18, lastbuyprice_withDiscountAndTax = 79.18
                where sellbilldetailid = 2377;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (54, '2026-10-14', 651.50385926659, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.50385926659, sellCostBuyPrice =sellCostBuyPrice+633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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+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-14', 651.50385926659, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.50385926659, sellCostBuyPrice =sellCostBuyPrice+633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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 = '87', userid = '1', storedetaildate = '2026-10-14 20:27:55' WHERE storedetailid = '54';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('54', '1', '8', '1', '301', 'اضافة فاتورة مبيعات', 'sellbillController.php', '95', '87', '1', '2026-10-14 20:27:55','0','0'); -- id=4315
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18895.3', '18895.3', '2026-10-14', '1', '0', '0', '2026-10-14 20:27:55','اضافة فاتورة مبيعات رقم 301','1','0',null,'0','301','sellbillController.php?do=showDetail&sellbillid=301'); -- id=1614
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1614', '453', '18517.39', '','0'); -- id=1626
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '22553.39', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1614', '398', '377.91', '','0'); -- id=1627
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '47870.47', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1614', '143', '18895.3', '','0'); -- id=1617
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1270253.03', 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 ( '18137.9', '18137.9', '2026-10-14', '1', '0', '0', '2026-10-14 20:27:55','اضافة فاتورة مبيعات رقم 301 - صرف البضاعة من المخزن','1','0',null,'0','301','sellbillController.php?do=showDetail&sellbillid=301'); -- id=1615
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1615', '402', '18137.9', '','0'); -- id=1628
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1137202.99', 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 ('1615', '382', '18137.9', '','0'); -- id=1618
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2321791.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='1614,0,1615' where sellbillid=301;
 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-14', 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18137.9, 18137.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18517.39, sellCostBuyPrice =sellCostBuyPrice+18137.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18137.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18137.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18137.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18137.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18137.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18137.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18137.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (24, '2026-10-14', 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18137.9, 18137.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18517.39, sellCostBuyPrice =sellCostBuyPrice+18137.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18137.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18137.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18137.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18137.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18137.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18137.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18137.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9, 18137.9, 18137.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+18517.39, netSellCostBuyPrice = netSellCostBuyPrice+18137.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18137.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18137.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18137.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18137.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18137.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18137.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18137.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06acfc672aa000 and sellbillId = 301 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 16:57:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:27:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:27:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4225
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:06:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:36:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:36:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4226
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:06:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:36:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:36:57', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4227
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:07:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:37:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:37:03', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=301'); -- id=4228
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:07:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:37:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:37:27', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4229
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 301;
UPDATE sellbill SET  sellbillsysdate = '2026-10-14 20:37:27', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '301';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-108 where id = 121;
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0,108,0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3254.579296968, sellCostBuyPrice =sellCostBuyPrice-3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3186
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-108
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3254.579296968, sellCostBuyPrice =sellCostBuyPrice-3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3186
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '908', userid = '1', storedetaildate = '2026-10-14 20:37:27' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '108', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '800', '908', '1', '2026-10-14 20:27:50','0','0'); -- id=4316
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-108 where id = 127;
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0,108,0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3254.579296968, sellCostBuyPrice =sellCostBuyPrice-3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3186
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-108
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.579296968, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3254.579296968, sellCostBuyPrice =sellCostBuyPrice-3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3186
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '870', userid = '1', storedetaildate = '2026-10-14 20:37:27' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '108', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '762', '870', '1', '2026-10-14 20:27:50','0','0'); -- id=4317
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-100 where id = 120;
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 2368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-14', 4507.9990262129, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0,100,0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4507.9990262129, sellCostBuyPrice =sellCostBuyPrice-4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4433
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 4507.9990262129, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4507.9990262129, sellCostBuyPrice =sellCostBuyPrice-4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4433
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '654', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '100', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '554', '654', '1', '2026-10-14 20:27:50','0','0'); -- id=4318
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-100 where id = 128;
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 2369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-10-14', 862.39981371029, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0,100,0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-862.39981371029, sellCostBuyPrice =sellCostBuyPrice-844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-844, sellCostMeanBuyPrice = sellCostMeanBuyPrice-844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-844
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 862.39981371029, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-862.39981371029, sellCostBuyPrice =sellCostBuyPrice-844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-844, sellCostMeanBuyPrice = sellCostMeanBuyPrice-844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-844
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1751', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '100', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1651', '1751', '1', '2026-10-14 20:27:50','0','0'); -- id=4319
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 2370;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-14', 2500.9594597598, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2500.9594597598, sellCostBuyPrice =sellCostBuyPrice-2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2448
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 2500.9594597598, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2500.9594597598, sellCostBuyPrice =sellCostBuyPrice-2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2448
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '219', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '8', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '211', '219', '1', '2026-10-14 20:27:50','0','0'); -- id=4320
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 122;
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 2371;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-10-14', 311.63993268167, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-311.63993268167, sellCostBuyPrice =sellCostBuyPrice-304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice-304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-304.02
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 311.63993268167, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-311.63993268167, sellCostBuyPrice =sellCostBuyPrice-304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice-304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-304.02
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '119', '125', '1', '2026-10-14 20:27:50','0','0'); -- id=4321
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 131;
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 2372;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-10-14', 1932.5595825417, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1932.5595825417, sellCostBuyPrice =sellCostBuyPrice-1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1900
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 1932.5595825417, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1932.5595825417, sellCostBuyPrice =sellCostBuyPrice-1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1900
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '8', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '116', '124', '1', '2026-10-14 20:27:50','0','0'); -- id=4322
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 126;
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 2373;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-10-14', 189.62995903743, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-189.62995903743, sellCostBuyPrice =sellCostBuyPrice-184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.75
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 189.62995903743, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-189.62995903743, sellCostBuyPrice =sellCostBuyPrice-184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.75
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '157', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '152', '157', '1', '2026-10-14 20:27:50','0','0'); -- id=4323
UPDATE sellbilldetail SET  lastbuyprice = 68.63 , meanbuyprice = 68.63, lastbuyprice_withDiscount = 68.63, meanbuyprice_withDiscount = 68.63
        , lastbuyprice_withTax = 68.63, meanbuyprice_withTax = 68.63, lastbuyprice_withDiscountAndTax = 68.63
                where sellbilldetailid = 2374;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (52, '2026-10-14', 352.79992379057, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-352.79992379057, sellCostBuyPrice =sellCostBuyPrice-343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice-343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-343.15
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-14', 352.79992379057, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-352.79992379057, sellCostBuyPrice =sellCostBuyPrice-343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice-343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-343.15
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '131', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '52';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '1', '5', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '126', '131', '1', '2026-10-14 20:27:50','0','0'); -- id=4324
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 129;
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 2375;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-14', 326.33992950628, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-326.33992950628, sellCostBuyPrice =sellCostBuyPrice-316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice-316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-316.74
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-14', 326.33992950628, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-326.33992950628, sellCostBuyPrice =sellCostBuyPrice-316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice-316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-316.74
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-14 20:37:28' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '6', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '179', '185', '1', '2026-10-14 20:27:50','0','0'); -- id=4325
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 125;
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-14', 372.39991955672, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-372.39991955672, sellCostBuyPrice =sellCostBuyPrice-358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-358.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 372.39991955672, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-372.39991955672, sellCostBuyPrice =sellCostBuyPrice-358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-358.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '145', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '4', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '141', '145', '1', '2026-10-14 20:27:50','0','0'); -- id=4326
UPDATE sellbilldetail SET  lastbuyprice = 79.18 , meanbuyprice = 79.18, lastbuyprice_withDiscount = 79.18, meanbuyprice_withDiscount = 79.18
        , lastbuyprice_withTax = 79.18, meanbuyprice_withTax = 79.18, lastbuyprice_withDiscountAndTax = 79.18
                where sellbilldetailid = 2377;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (54, '2026-10-14', 651.50385926659, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-651.50385926659, sellCostBuyPrice =sellCostBuyPrice-633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice-633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-633.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-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-14', 651.50385926659, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-651.50385926659, sellCostBuyPrice =sellCostBuyPrice-633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice-633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-633.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 = '95', userid = '1', storedetaildate = '2026-10-14 20:37:28' WHERE storedetailid = '54';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('54', '1', '8', '0', '301', 'تعديل فاتورة مبيعات', 'sellbillController.php', '87', '95', '1', '2026-10-14 20:27:50','0','0'); -- id=4327
CALL clientInUse(24,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '4036', userid = '1' WHERE clientid = '24';
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 ('24','22553.39','18517.39','1','تعديل فاتورة مبيعات','301', '4036', '2026-10-14 20:27:50', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '18517.39', '0', null, '0', null, null,'', '0','1','1','18517.39','1','2026-10-14 20:27:50','0','0','',''); -- id=509
UPDATE client SET  inUse = 0 where clientid = 24;
 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-14', 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18137.9, 18137.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-18517.39, sellCostBuyPrice =sellCostBuyPrice-18137.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18137.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18137.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18137.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18137.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18137.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18137.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18137.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (24, '2026-10-14', 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18137.9, 18137.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-18517.39, sellCostBuyPrice =sellCostBuyPrice-18137.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18137.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18137.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18137.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18137.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18137.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18137.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18137.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 18517.39, 18137.9, 18137.9
                    , 18137.9, 18137.9, 18137.9, 18137.9, 18137.9, 18137.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-18517.39, netSellCostBuyPrice = netSellCostBuyPrice-18137.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-18137.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-18137.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-18137.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-18137.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-18137.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-18137.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-18137.9;

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


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

COMMIT;
BEGIN;
CALL clientInUse(24,@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-14 20:27:50', '06acfc672aa000', '24', '4036.00', '22747.43', '2', '2', '19093.3', '18711.43', '0', '18711.43', '1', '2026-10-14 20:27:50', '', '1', '0', 'وليد الهنداوي', '1', '1', '3', '0', '24 - وليد الهنداوي', '467', '301', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-14','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=302
UPDATE client SET  clientdebt = '22747.43', userid = '1' WHERE clientid = '24';
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 ('24','4036.00','18711.43','0','اضافة فاتورة مبيعات (معدله)','302', '22747.43', '2026-10-14 20:37:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '18711.43', '0', null, '0', null, null,'', '0','1','1','18517.39','1','2026-10-14 20:27:50','0','0','',''); -- id=510
UPDATE client SET  inUse = 0 where clientid = 24;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+108 where id = 121;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '302', '1', '42', '108.00', '30.75', '3321', '0', '', '1', '2026-10-14 20:37:30', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','121-108,','1','1','0','0','30.75','3321','0','','0','0.00','0','0','0','0'); -- id=2378
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2378;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-14', 3254.5793042586, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.5793042586, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+108
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.5793042586, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.5793042586, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '800', userid = '1', storedetaildate = '2026-10-14 20:37:30' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '108', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '908', '800', '1', '2026-10-14 20:37:30','0','0'); -- id=4328
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+108 where id = 127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '302', '1', '43', '108.00', '30.75', '3321', '0', '', '1', '2026-10-14 20:37:30', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','127-108,','1','1','0','0','30.75','3321','0','','0','0.00','0','0','0','0'); -- id=2379
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2379;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-10-14', 3254.5793042586, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.5793042586, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+108
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 3254.5793042586, 3186, 3186
                    , 3186, 3186, 3186, 3186
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3186, 3186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3254.5793042586, sellCostBuyPrice =sellCostBuyPrice+3186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3186, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3186
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3186
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '762', userid = '1', storedetaildate = '2026-10-14 20:37:30' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '108', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '870', '762', '1', '2026-10-14 20:37:30','0','0'); -- id=4329
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 120;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '302', '1', '41', '100.00', '46', '4600', '0', '', '1', '2026-10-14 20:37:30', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','120-100,','1','1','0','0','46','4600','0','','0','0.00','0','0','0','0'); -- id=2380
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 2380;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-14', 4507.9990363112, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4507.9990363112, sellCostBuyPrice =sellCostBuyPrice+4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4433
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 4507.9990363112, 4433, 4433
                    , 4433, 4433, 4433, 4433
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4433, 4433, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4507.9990363112, sellCostBuyPrice =sellCostBuyPrice+4433
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4433, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4433
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4433, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4433
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4433
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4433
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4433
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '554', userid = '1', storedetaildate = '2026-10-14 20:37:30' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '100', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '654', '554', '1', '2026-10-14 20:37:31','0','0'); -- id=4330
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 128;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.44','00044', '302', '1', '44', '100.00', '8.8', '880.0000000000001', '0', '', '1', '2026-10-14 20:37:31', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','128-100,','1','1','0','0','8.8','880','0','','0','0.00','0','0','0','0'); -- id=2381
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 2381;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-10-14', 862.39981564214, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+862.39981564214, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 862.39981564214, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+862.39981564214, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1651', userid = '1', storedetaildate = '2026-10-14 20:37:31' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '100', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1751', '1651', '1', '2026-10-14 20:37:31','0','0'); -- id=4331
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '302', '1', '9', '8.00', '319', '2552', '0', '', '1', '2026-10-14 20:37:31', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-8,','1','1','0','0','319','2552','0','','0','0.00','0','0','0','0'); -- id=2382
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 = 2382;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-14', 2500.9594653622, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2500.9594653622, sellCostBuyPrice =sellCostBuyPrice+2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2448
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 2500.9594653622, 2448, 2448
                    , 2448, 2448, 2448, 2448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2448, 2448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2500.9594653622, sellCostBuyPrice =sellCostBuyPrice+2448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2448
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '211', userid = '1', storedetaildate = '2026-10-14 20:37:31' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '8', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '219', '211', '1', '2026-10-14 20:37:31','0','0'); -- id=4332
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 122;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50.67','00053', '302', '1', '53', '6.00', '53', '318', '0', '', '1', '2026-10-14 20:37:31', '53', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','122-6,','1','1','0','0','53','318','0','','0','0.00','0','0','0','0'); -- id=2383
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 2383;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-10-14', 311.63993337977, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+311.63993337977, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 311.63993337977, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+311.63993337977, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '119', userid = '1', storedetaildate = '2026-10-14 20:37:32' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '119', '1', '2026-10-14 20:37:32','0','0'); -- id=4333
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237.5','00045', '302', '1', '45', '8.00', '246.5', '1972', '0', '', '1', '2026-10-14 20:37:32', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','131-8,','1','1','0','0','246.5','1972','0','','0','0.00','0','0','0','0'); -- id=2384
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 2384;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-10-14', 1932.5595868708, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1932.5595868708, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 1932.5595868708, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1932.5595868708, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2026-10-14 20:37:32' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '8', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '116', '1', '2026-10-14 20:37:32','0','0'); -- id=4334
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 126;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('36.95','00051', '302', '1', '51', '5.00', '38.7', '193.5', '0', '', '1', '2026-10-14 20:37:32', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','126-5,','1','1','0','0','38.7','193.5','0','','0','0.00','0','0','0','0'); -- id=2385
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 2385;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-10-14', 189.62995946222, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.62995946222, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 189.62995946222, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.62995946222, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '152', userid = '1', storedetaildate = '2026-10-14 20:37:32' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '157', '152', '1', '2026-10-14 20:37:32','0','0'); -- id=4335
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('68.63','00052', '302', '1', '52', '5.00', '72', '360', '0', '', '1', '2026-10-14 20:37:32', '52', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','72','360','0','','0','0.00','0','0','0','0'); -- id=2386
UPDATE sellbilldetail SET  lastbuyprice = 68.63 , meanbuyprice = 68.63, lastbuyprice_withDiscount = 68.63, meanbuyprice_withDiscount = 68.63
        , lastbuyprice_withTax = 68.63, meanbuyprice_withTax = 68.63, lastbuyprice_withDiscountAndTax = 68.63
                where sellbilldetailid = 2386;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (52, '2026-10-14', 352.79992458087, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.79992458087, sellCostBuyPrice =sellCostBuyPrice+343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 352.79992458087, 343.15, 343.15
                    , 343.15, 343.15, 343.15, 343.15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 343.15, 343.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.79992458087, sellCostBuyPrice =sellCostBuyPrice+343.15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+343.15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+343.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+343.15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+343.15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '126', userid = '1', storedetaildate = '2026-10-14 20:37:33' WHERE storedetailid = '52';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '1', '5', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '131', '126', '1', '2026-10-14 20:37:33','0','0'); -- id=4336
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 129;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00048', '302', '1', '48', '6.00', '55.5', '333', '0', '', '1', '2026-10-14 20:37:33', '48', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','129-6,','1','1','0','0','55.5','333','0','','0','0.00','0','0','0','0'); -- id=2387
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 2387;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-14', 326.33993023731, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+326.33993023731, sellCostBuyPrice =sellCostBuyPrice+316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-14', 326.33993023731, 316.74, 316.74
                    , 316.74, 316.74, 316.74, 316.74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 316.74, 316.74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+326.33993023731, sellCostBuyPrice =sellCostBuyPrice+316.74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-10-14 20:37:33' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '6', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '185', '179', '1', '2026-10-14 20:37:33','0','0'); -- id=4337
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 125;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '302', '1', '47', '4.00', '95', '380', '0', '', '1', '2026-10-14 20:37:33', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','125-4,','1','1','0','0','95','380','0','','0','0.00','0','0','0','0'); -- id=2388
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2388;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-14', 372.39992039092, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+372.39992039092, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-14', 372.39992039092, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+372.39992039092, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '1', storedetaildate = '2026-10-14 20:37:33' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '4', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '145', '141', '1', '2026-10-14 20:37:33','0','0'); -- id=4338
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('79.18','00054', '302', '1', '54', '8.00', '83.1', '664.8', '0', '', '1', '2026-10-14 20:37:33', '54', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','83.1','664.8','0','','0','0.00','0','0','0','0'); -- id=2389
UPDATE sellbilldetail SET  lastbuyprice = 79.18 , meanbuyprice = 79.18, lastbuyprice_withDiscount = 79.18, meanbuyprice_withDiscount = 79.18
        , lastbuyprice_withTax = 79.18, meanbuyprice_withTax = 79.18, lastbuyprice_withDiscountAndTax = 79.18
                where sellbilldetailid = 2389;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (54, '2026-10-14', 651.50386072601, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.50386072601, sellCostBuyPrice =sellCostBuyPrice+633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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+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-14', 651.50386072601, 633.44, 633.44
                    , 633.44, 633.44, 633.44, 633.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 633.44, 633.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.50386072601, sellCostBuyPrice =sellCostBuyPrice+633.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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 = '87', userid = '1', storedetaildate = '2026-10-14 20:37:34' WHERE storedetailid = '54';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('54', '1', '8', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '95', '87', '1', '2026-10-14 20:37:34','0','0'); -- id=4339
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 147;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('190','00548', '302', '1', '548', '1', '198', '198', '0', '', '1', '2026-10-14 20:37:34', '548', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','147-1,','1','1','0','0','198','198','0','','0','0.00','0','0','0','0'); -- id=2390
UPDATE sellbilldetail SET  lastbuyprice = 190.00 , meanbuyprice = 190.00, lastbuyprice_withDiscount = 190.00, meanbuyprice_withDiscount = 190.00
        , lastbuyprice_withTax = 190, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 190
                where sellbilldetailid = 2390;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (548, '2026-10-14', 194.03995851948, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+194.03995851948, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-14', 194.03995851948, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+194.03995851948, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-14 20:37:34' WHERE storedetailid = '548';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('548', '1', '1', '1', '302', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '29', '1', '2026-10-14 20:37:34','0','0'); -- id=4340
UPDATE dailyentry SET totalcreditor = '18895.30', totaldebtor = '18895.30', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 20:27:55', entryComment = 'اضافة فاتورة مبيعات رقم 301', fromFlag = '1',related='0',isopeningentry='0',operationId='301',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=301' WHERE id = '1614';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18895.30', '18895.30', '2026-10-14', '1', '0', '1614', '2026-10-14 20:37:34','تم عكس القيد رقم 1614 ','1','0','0','0','0',''); -- id=1616
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1616', '453', '18517.39', '','0'); -- id=1619
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '4036', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1616', '398', '377.91', '','0'); -- id=1620
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '47492.56', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1616', '143', '18895.30', '','0'); -- id=1629
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1251357.73', 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 = '18137.90', totaldebtor = '18137.90', thedate = '2026-10-14', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-14 20:27:55', entryComment = 'اضافة فاتورة مبيعات رقم 301 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='301',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=301' WHERE id = '1615';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18137.90', '18137.90', '2026-10-14', '1', '0', '1615', '2026-10-14 20:37:35','تم عكس القيد رقم 1615 ','1','0','0','0','0',''); -- id=1617
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1617', '402', '18137.90', '','0'); -- id=1621
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1119065.09', 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 ('1617', '382', '18137.90', '','0'); -- id=1630
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2339929.35', 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 ( '19093.3', '19093.3', '2026-10-14', '1', '0', '0', '2026-10-14 20:37:35','اضافة فاتورة مبيعات رقم 302','1','0',null,'0','302','sellbillController.php?do=showDetail&sellbillid=302'); -- id=1618
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1618', '453', '18711.43', '','0'); -- id=1631
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '22747.43', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1618', '398', '381.87', '','0'); -- id=1632
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '47874.43', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1618', '143', '19093.3', '','0'); -- id=1622
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1270451.03', 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 ( '18327.9', '18327.9', '2026-10-14', '1', '0', '0', '2026-10-14 20:37:35','اضافة فاتورة مبيعات رقم 302 - صرف البضاعة من المخزن','1','0',null,'0','302','sellbillController.php?do=showDetail&sellbillid=302'); -- id=1619
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1619', '402', '18327.9', '','0'); -- id=1633
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1137392.99', 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 ('1619', '382', '18327.9', '','0'); -- id=1623
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2321601.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='1618,0,1619' where sellbillid=302;
 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-14', 18711.43, 18327.9, 18327.9
                    , 18327.9, 18327.9, 18327.9, 18327.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18327.9, 18327.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18711.43, sellCostBuyPrice =sellCostBuyPrice+18327.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18327.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18327.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18327.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18327.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18327.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18327.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18327.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (24, '2026-10-14', 18711.43, 18327.9, 18327.9
                    , 18327.9, 18327.9, 18327.9, 18327.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18327.9, 18327.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18711.43, sellCostBuyPrice =sellCostBuyPrice+18327.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18327.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18327.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18327.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18327.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18327.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18327.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18327.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 18711.43, 18327.9, 18327.9
                    , 18327.9, 18327.9, 18327.9, 18327.9, 18327.9, 18327.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+18711.43, netSellCostBuyPrice = netSellCostBuyPrice+18327.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18327.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18327.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18327.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18327.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18327.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18327.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18327.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 301 and newid=302 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:07:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:37:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 20:37:37', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=302'); -- id=4230
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:29:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 20:59:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 20:59:16', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4231
UPDATE productunit SET unitid = '1', productid = '461', productnumber = '1.00', productunitdate = '2026-09-24', userid = '1', conditions = '0',proUnitParcode='0046101',proUnitSellAllPrice='41',proUnitSellHalfPrice='41',proUnitSellUnitPrice ='41',proUnitBuyPrice='39',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '461';
UPDATE product SET productName = 'لقمه تلفون ', productDescription = '', productCatId = '3', productBuyPrice = '39.36', productSellAllPrice = '41', productSellUnitPrice = '41', productSellHalfPrice = '41', productDate = '2026-09-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00461',type ='0', expireDate = '0' , dailyentryId = '864',isService = '0',isOptic = '0',lastbuyprice = '39.00',lastbuyprice_withDiscount = '39',meanbuyprice = '39.00',meanbuyprice_withDiscount = '39' , productbuypricereal = '39' , buypricereal_precentage = '0' , buytotal_precentage = '5.13' , buyhalf_precentage = '5.13' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',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='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 = '461';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:07:26', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4232
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 ('06acfd11004cc0', '2026-10-14 20:59:28', '11', '42680.30', '46858.7', '0', '0', '4178.40',  '4178.40', '0', '4178.4', '1', '2026-10-14 21:07:26', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=52
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 ('00110', '52', '3', '110', '24', '108.5', '2604.00', '0', '', '2026-10-14 21:07:26', '110','','','0','0','0','0','0',null,'108.5','2604','0','0','0','0','0','0','0','0','1'); -- id=192
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-14 20:59:28', 1, 110, 0, 0
                    , 108.5, 24, 0, 0, 1, '2026-10-14 21:07:27')
                ON DUPLICATE KEY UPDATE buyprice = 108.5,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-14 21:07:27' ; -- id=192
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('110', '108.5', '24', '0', 'buyBillController.php', '192', '', '0', '0'); -- id=192
UPDATE product SET  productBuyPrice = "108.5" WHERE productId = 110 ;
UPDATE buybilldetail SET  quantitybefore = 6 WHERE buybilldetailid = 192 ;
UPDATE product SET productName = 'مفتاح اتوماتيك 32 امبير', productDescription = '', productCatId = '3', productBuyPrice = '108.50', productSellAllPrice = '110.00', productSellUnitPrice = '110.00', productSellHalfPrice = '110.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00110',type ='0', expireDate = '0' , dailyentryId = '119',isService = '0',isOptic = '0',lastbuyprice = '108.5',lastbuyprice_withDiscount = '108.5',meanbuyprice = '108',meanbuyprice_withDiscount = '108' , productbuypricereal = '106.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.77' , buyhalf_precentage = '3.77' , buypart_precentage = '3.77',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='106',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='108.5',meanbuyprice_withTax='108',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='108.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 = '110';
UPDATE buybilldetail SET  lastbuyprice = 108.5 , meanbuyprice = 108, lastbuyprice_withDiscount = 108.5, meanbuyprice_withDiscount = 108
        , lastbuyprice_withTax = 108.5, meanbuyprice_withTax = 108, lastbuyprice_withDiscountAndTax = 108.5
                where buybilldetailid = 192;
UPDATE productunit SET proUnitBuyPrice  = 108.5 * productnumber WHERE productid = 110;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '1', '24', '0', '52', 'اضافة فاتورة مشتريات', 'buyBillController.php', '6', '30', '1', '2026-10-14 20:59:28','0','0'); -- id=4341
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 ('00461', '52', '3', '461', '40', '39.36', '1574.40', '0', '', '2026-10-14 21:07:26', '461','','','0','0','0','0','0',null,'39.36','1574.4','0','0','0','0','0','0','0','0','1'); -- id=193
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-14 20:59:28', 1, 461, 0, 0
                    , 39.36, 40, 0, 0, 1, '2026-10-14 21:07:28')
                ON DUPLICATE KEY UPDATE buyprice = 39.36,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-14 21:07:28' ; -- id=193
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('461', '39.36', '40', '0', 'buyBillController.php', '193', '', '0', '0'); -- id=193
UPDATE product SET  productBuyPrice = "39.36" WHERE productId = 461 ;
UPDATE buybilldetail SET  quantitybefore = 29 WHERE buybilldetailid = 193 ;
UPDATE product SET productName = 'لقمه تلفون ', productDescription = '', productCatId = '3', productBuyPrice = '39.36', productSellAllPrice = '41.00', productSellUnitPrice = '41.00', productSellHalfPrice = '41.00', productDate = '2026-09-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00461',type ='0', expireDate = '0' , dailyentryId = '864',isService = '0',isOptic = '0',lastbuyprice = '39.36',lastbuyprice_withDiscount = '39.36',meanbuyprice = '39.21',meanbuyprice_withDiscount = '39.21' , productbuypricereal = '39.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.13' , buyhalf_precentage = '5.13' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',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='39.36',meanbuyprice_withTax='39.21',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.36',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '461';
UPDATE buybilldetail SET  lastbuyprice = 39.36 , meanbuyprice = 39.21, lastbuyprice_withDiscount = 39.36, meanbuyprice_withDiscount = 39.21
        , lastbuyprice_withTax = 39.36, meanbuyprice_withTax = 39.21, lastbuyprice_withDiscountAndTax = 39.36
                where buybilldetailid = 193;
UPDATE productunit SET proUnitBuyPrice  = 39.36 * productnumber WHERE productid = 461;
UPDATE storedetail SET  productquantity = '69', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '461';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('461', '1', '40', '0', '52', 'اضافة فاتورة مشتريات', 'buyBillController.php', '29', '69', '1', '2026-10-14 20:59:28','0','0'); -- id=4342
UPDATE supplier SET  suppliercurrentDebt = '46858.7',suppliercurrentDebtInCurrency= '46858.7' , userid = '1', supplierdate = '2026-10-14 21:07:26'   WHERE supplierid = '11';
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 ('11', '42680.30', '4178.4', '0', 'اضافة فاتورة مشتريات', '52', '46858.7', '2026-10-14 20:59:28', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','4178.4','1','42680.3','4178.4','46858.7','0',''); -- id=92
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4178.4', '4178.4', '2026-10-14', '1', '0', '0', '2026-10-14 21:07:29','اضافة فاتورة مشتريات رقم 52','1','0',null,'0','52','buyBillController.php?do=details&id=52'); -- id=1620
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1620', '382', '4178.4', '','0'); -- id=1634
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2325779.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 ('1620', '440', '4178.4', '','0'); -- id=1624
UPDATE accountstree SET name = 'اسلام طارق جوي', customName = 'اسلام طارق جوي', customNameEn = 'اسلام طارق جوي', nameEn = 'اسلام طارق جوي', parent = '81', accountNature = '1', theValue = '46858.7', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:01:56' WHERE id = '440';
update buybill set dailyentryid='1620,0' where buybillid=52;
COMMIT;
UPDATE product SET overAllAveragePrice = 108.5 WHERE productId = 110;UPDATE product SET overAllAveragePrice = 39.24 WHERE productId = 461;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:07:30', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=52'); -- id=4233
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 21:07:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4234
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 21:07:47', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=4235
BEGIN;
CALL supplierInUse(11,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('11', '46858.70', '10000', '1', 'ايصال دفع لمورد', '1', '36858.7', '2026-10-14 21:07:38', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','10000','1','0','0','0','26',''); -- id=93
UPDATE supplierdebtchange SET supplierid = '11', supplierdebtchangebefore = '46858.70', supplierdebtchangeamount = '10000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '36858.7', supplierdebtchangedate = '2026-10-14 21:07:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='46858.7',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='36858.7', paySerialNo='26',tagids='' WHERE supplierdebtchangeid = '93';
UPDATE supplier SET  suppliercurrentDebt = '36858.7',suppliercurrentDebtInCurrency= '36858.7' , userid = '1', supplierdate = '2026-10-14 21:07:47'   WHERE supplierid = '11';
UPDATE supplier SET  inUse = 0 where supplierid = 11;
UPDATE save SET  savecurrentvalue = '-807942.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-797942.75','10000', '1', '1', 'ايصال دفع لمورد', '93', '-807942.75', '2026-10-14 21:07:48', '1',  'supplierPayedDeptController.php','0','','0'); -- id=314
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-10-14', '1', '0', '0', '2026-10-14 21:07:48','ايصال دفع لمورد ( اسلام طارق جوي ) ','1','0','0','0','93','supplierReportsController.php?do=show&id=93'); -- id=1621
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1621', '440', '10000', '','0'); -- id=1635
UPDATE accountstree SET name = 'اسلام طارق جوي', customName = 'اسلام طارق جوي', customNameEn = 'اسلام طارق جوي', nameEn = 'اسلام طارق جوي', parent = '81', accountNature = '1', theValue = '36858.7', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:01:56' WHERE id = '440';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1621', '383', '10000', '','0'); -- id=1625
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-12929.01', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '11', supplierdebtchangebefore = '46858.70', supplierdebtchangeamount = '10000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '36858.70', supplierdebtchangedate = '2026-10-14 21:07:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1621',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='46858.7',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='36858.7', paySerialNo='26',tagids='' WHERE supplierdebtchangeid = '93';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 21:07:49', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=4236
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:07:50', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4237
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-14 21:07:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=4238
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:37:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:07:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-14 21:07:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=4239
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:38:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:08:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:08:24', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4240
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 ('06acfd30776d55', '2026-10-14 21:07:51', '1', '81528.92', '81528.92', '0', '0', '16065.00',  '16065.00', '16065', '0', '1', '2026-10-14 21:08:24', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=53
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 ('00006', '53', '1', '6', '153', '105', '16065.00', '0', '', '2026-10-14 21:08:24', '6','','','0','0','0','0','0',null,'105','16065','0','0','0','0','0','0','0','0','1'); -- id=194
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-14 21:07:51', 1, 6, 0, 0
                    , 105, 153, 0, 0, 1, '2026-10-14 21:08:24')
                ON DUPLICATE KEY UPDATE buyprice = 105,
                        buyQuantity =buyQuantity+153, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-14 21:08:24' ; -- id=194
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('6', '105', '153', '0', 'buyBillController.php', '194', '', '0', '0'); -- id=194
UPDATE product SET  productBuyPrice = "105" WHERE productId = 6 ;
UPDATE buybilldetail SET  quantitybefore = 291 WHERE buybilldetailid = 194 ;
UPDATE product SET productName = 'بريزه ام كي اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '105.00', productSellAllPrice = '106.00', productSellUnitPrice = '109.00', productSellHalfPrice = '106.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '40', parcode = '00006',type ='0', expireDate = '0' , dailyentryId = '11',isService = '0',isOptic = '0',lastbuyprice = '105',lastbuyprice_withDiscount = '105',meanbuyprice = '105',meanbuyprice_withDiscount = '105' , productbuypricereal = '105.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.95' , buyhalf_precentage = '0.95' , buypart_precentage = '3.81',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='105',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='105',meanbuyprice_withTax='105',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='105',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '6';
UPDATE buybilldetail SET  lastbuyprice = 105 , meanbuyprice = 105, lastbuyprice_withDiscount = 105, meanbuyprice_withDiscount = 105
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where buybilldetailid = 194;
UPDATE productunit SET proUnitBuyPrice  = 105 * productnumber WHERE productid = 6;
UPDATE storedetail SET  productquantity = '444', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '153', '0', '53', 'اضافة فاتورة مشتريات', 'buyBillController.php', '291', '444', '1', '2026-10-14 21:07:51','0','0'); -- id=4343
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-14 21:08:24'   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', 'اضافة فاتورة مشتريات', '53', '81528.92', '2026-10-14 21:07:51', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=94
UPDATE save SET  savecurrentvalue = '-824007.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-807942.75','16065', '1', '1', 'اضافة فاتورة مشتريات', '53', '-824007.75', '2026-10-14 21:07:51', '1',  'buyBillController.php','0','','0'); -- id=315
update buybill set dailyentryid='0,0' where buybillid=53;
COMMIT;
UPDATE product SET overAllAveragePrice = 105 WHERE productId = 6;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:38:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:08:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:08:26', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=53'); -- id=4241
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:38:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:08:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-14 21:08:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4242
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:39:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:09:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:09:58', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4243
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:40:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:10:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:10:14', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4244
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 ('06acfd3876f482', '2026-10-14 21:09:59', '1', '81528.92', '81528.92', '0', '0', '5782.00',  '5782.00', '5782', '0', '1', '2026-10-14 21:10:14', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=54
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 ('00039', '54', '1', '39', '2', '2891', '5782.00', '0', '', '2026-10-14 21:10:14', '39','','','0','0','0','0','0',null,'2891','5782','0','0','0','0','0','0','0','0','1'); -- id=195
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-14 21:09:59', 1, 39, 0, 0
                    , 2891, 2, 0, 0, 1, '2026-10-14 21:10:15')
                ON DUPLICATE KEY UPDATE buyprice = 2891,
                        buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-14 21:10:15' ; -- id=195
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('39', '2891', '2', '0', 'buyBillController.php', '195', '', '0', '0'); -- id=195
UPDATE product SET  productBuyPrice = "2891" WHERE productId = 39 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 195 ;
UPDATE product SET productName = 'مفتاح كوتله 160 امبير ', productDescription = '', productCatId = '1', productBuyPrice = '2891.00', productSellAllPrice = '2800.00', productSellUnitPrice = '3050.00', productSellHalfPrice = '2800.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '0', parcode = '00039',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '2891',lastbuyprice_withDiscount = '2891',meanbuyprice = '2891',meanbuyprice_withDiscount = '2891' , productbuypricereal = '2720.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.94' , buyhalf_precentage = '2.94' , buypart_precentage = '12.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2891',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='2891',meanbuyprice_withTax='2891',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='2891',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '39';
UPDATE buybilldetail SET  lastbuyprice = 2891 , meanbuyprice = 2891, lastbuyprice_withDiscount = 2891, meanbuyprice_withDiscount = 2891
        , lastbuyprice_withTax = 2891, meanbuyprice_withTax = 2891, lastbuyprice_withDiscountAndTax = 2891
                where buybilldetailid = 195;
UPDATE productunit SET proUnitBuyPrice  = 2891 * productnumber WHERE productid = 39;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-14' WHERE storedetailid = '39';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '1', '2', '0', '54', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '2', '1', '2026-10-14 21:09:59','0','0'); -- id=4344
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-14 21:10:14'   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', 'اضافة فاتورة مشتريات', '54', '81528.92', '2026-10-14 21:09:59', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=95
UPDATE save SET  savecurrentvalue = '-829789.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-824007.75','5782', '1', '1', 'اضافة فاتورة مشتريات', '54', '-829789.75', '2026-10-14 21:09:59', '1',  'buyBillController.php','0','','0'); -- id=316
update buybill set dailyentryid='0,0' where buybillid=54;
COMMIT;
UPDATE product SET overAllAveragePrice = 2891 WHERE productId = 39;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-14 17:40:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-14 21:10:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-14 21:10:16', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=54'); -- id=4245
