UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 05:57:21";
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-20 05:59:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 09:29:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-20 09:29:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=4673
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-20',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='9aad922c8dc25742295df2779fde48ab62230719d569b9aa71bf6d5e0e08471c7dbda60d508155af60894a0ba3bbd86ffbee699027a409bcd9ca11e28a846cc5',associatedtags='0',commentClientChasis='0',dollarExType='64',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0'
                ,reviewRecords='',reviewRecordsLastDate='0000-00-00',showepayrestaurant='0',showSellAllPriceInStoreDetail='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:00:01";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-20 09:30:01', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=4674
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:00:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 09:30:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 09:30:08', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4675
UPDATE productunit SET unitid = '1', productid = '70', productnumber = '1.00', productunitdate = '2026-09-14', userid = '1', conditions = '0',proUnitParcode='0007001',proUnitSellAllPrice='460',proUnitSellHalfPrice='460',proUnitSellUnitPrice ='460',proUnitBuyPrice='348',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '70';
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو احمر', productDescription = '', productCatId = '12', productBuyPrice = '400', productSellAllPrice = '460', productSellUnitPrice = '460', productSellHalfPrice = '460', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '20', parcode = '00070',type ='0', expireDate = '0' , dailyentryId = '82',isService = '0',isOptic = '0',lastbuyprice = '348.00',lastbuyprice_withDiscount = '348',meanbuyprice = '332.81',meanbuyprice_withDiscount = '332.81' , productbuypricereal = '312' , buypricereal_precentage = '0' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='348',meanbuyprice_withTax='332.81',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='348',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '70';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:01:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 09:31:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 09:31:04', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4676
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 ('06ad7188276804', '2026-10-20 09:30:10', '1', '81528.92', '81528.92', '0', '0', '20000.00',  '20000.00', '20000', '0', '1', '2026-10-20 09:31:04', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=62
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00070', '62', '12', '70', '50', '400', '20000.00', '0', '', '2026-10-20 09:31:04', '70','','','0','0','0','0','0',null,'400','20000','0','0','0','0','0','0','0','0','1'); -- id=231
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 09:30:10', 1, 70, 0, 0
                    , 400, 50, 0, 0, 1, '2026-10-20 09:31:05')
                ON DUPLICATE KEY UPDATE buyprice = 400,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 09:31:05' ; -- id=231
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('70', '400', '50', '0', 'buyBillController.php', '231', '', '0', '0'); -- id=231
UPDATE product SET  productBuyPrice = "400" WHERE productId = 70 ;
UPDATE buybilldetail SET  quantitybefore = 57 WHERE buybilldetailid = 231 ;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو احمر', productDescription = '', productCatId = '12', productBuyPrice = '400.00', productSellAllPrice = '460.00', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '20', parcode = '00070',type ='0', expireDate = '0' , dailyentryId = '82',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '364.21',meanbuyprice_withDiscount = '364.21' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',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='400',meanbuyprice_withTax='364.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='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '70';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 364.21, lastbuyprice_withDiscount = 400, meanbuyprice_withDiscount = 364.21
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 364.21, lastbuyprice_withDiscountAndTax = 400
                where buybilldetailid = 231;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 70;
UPDATE storedetail SET  productquantity = '107', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '50', '0', '62', 'اضافة فاتورة مشتريات', 'buyBillController.php', '57', '107', '1', '2026-10-20 09:30:10','0','0'); -- id=4995
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-20 09:31:04'   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', 'اضافة فاتورة مشتريات', '62', '81528.92', '2026-10-20 09:30:10', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=107
UPDATE save SET  savecurrentvalue = '-830867.44',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-810867.44','20000', '1', '1', 'اضافة فاتورة مشتريات', '62', '-830867.44', '2026-10-20 09:30:10', '1',  'buyBillController.php','0','','0'); -- id=369
update buybill set dailyentryid='0,0' where buybillid=62;
COMMIT;
UPDATE product SET overAllAveragePrice = 363.08 WHERE productId = 70;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:01:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 09:31:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 09:31:06', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=62'); -- id=4677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:02:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 09:32:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 09:32:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4678
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:31:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:01:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:01:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:32:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:02:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:02:17', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:32:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:02:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:02:25', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=315'); -- id=4681
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:33:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:03:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:03:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4682
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-20 10:08:24', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=72
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('72', '0', '0', '', ''); -- id=72
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 ('72','0','0','0','إضافة عميل جديد','72', '0', '2026-10-20 10:08:24', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=597
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-20 10:08:25'); -- id=505
UPDATE client SET clientname = 'م /احمد سعد', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='505',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 = '72';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:39:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:09:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:09:44', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:42:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:12:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:12:29', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4684

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad721c96d5ec
-- ----------------------------------------------------------------------------------------------------

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-20 10:12:30', '06ad721c96d5ec', '1', '0.00', '0', '0', '1', '420.00', '420', '420', '0', '1', '2026-10-20 10:12:30', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','420','0','','0','0','420','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=352
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','اضافة فاتورة مبيعات','352', '0', '2026-10-20 10:12:30', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '420', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-20 10:12:30','0','0','',''); -- id=598
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00238', '352', '10', '238', '12', '35', '420', '0', '', '1', '2026-10-20 10:12:31', '238', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35','420','0','','0','0.00','0','0','0','0'); -- id=2826
UPDATE sellbilldetail SET  lastbuyprice = 24.00 , meanbuyprice = 24.00, lastbuyprice_withDiscount = 24.00, meanbuyprice_withDiscount = 24.00
        , lastbuyprice_withTax = 24, meanbuyprice_withTax = 24, lastbuyprice_withDiscountAndTax = 24
                where sellbilldetailid = 2826;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (238, '2026-10-20', 420, 288, 288
                    , 288, 288, 288, 288
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 288, 288, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+288
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+288, sellCostMeanBuyPrice = sellCostMeanBuyPrice+288
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+288
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+288
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 420, 288, 288
                    , 288, 288, 288, 288
                    , 0, 0, 0, 0
                    , 0, 0, 0, 288, 288, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+288
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+288, sellCostMeanBuyPrice = sellCostMeanBuyPrice+288
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+288
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+288
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2026-10-20 10:12:31' WHERE storedetailid = '238';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('238', '1', '12', '1', '352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '38', '1', '2026-10-20 10:12:31','0','0'); -- id=4996
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-830447.4375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-830867.4375','420', '0', '1', 'اضافة فاتورة مبيعات', '352', '-830447.4375', '2026-10-20 10:12:31', '1',  'sellbillController.php','1','','0'); -- id=370
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '420', '420', '2026-10-20', '1', '0', '0', '2026-10-20 10:12:31','اضافة فاتورة مبيعات رقم 352','1','0',null,'0','352','sellbillController.php?do=showDetail&sellbillid=352'); -- id=1803
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1803', '383', '420', '','0'); -- id=1819
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '193092.84', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1803', '143', '420', '','0'); -- id=1807
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1534247.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '288', '288', '2026-10-20', '1', '0', '0', '2026-10-20 10:12:31','اضافة فاتورة مبيعات رقم 352 - صرف البضاعة من المخزن','1','0',null,'0','352','sellbillController.php?do=showDetail&sellbillid=352'); -- id=1804
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1804', '402', '288', '','0'); -- id=1820
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1369374.3', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1804', '382', '288', '','0'); -- id=1808
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2199065.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='1803,0,1804' where sellbillid=352;
 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-20', 420, 288, 288
                    , 288, 288, 288, 288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,288, 288, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+288
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+288, sellCostMeanBuyPrice = sellCostMeanBuyPrice+288
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+288
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+288
                        , returnSellVal = returnSellVal+0, 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-20', 420, 288, 288
                    , 288, 288, 288, 288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,288, 288, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+288
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+288, sellCostMeanBuyPrice = sellCostMeanBuyPrice+288
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+288
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+288
                        , returnSellVal = returnSellVal+0, 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, 420, 288, 288
                    , 288, 288, 288, 288, 288, 288)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+420, netSellCostBuyPrice = netSellCostBuyPrice+288
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+288
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+288
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+288
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+288
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+288
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+288
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+288;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad721c96d5ec and sellbillId = 352 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:42:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:12:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:12:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:42:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:12:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:12:51', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4686

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad720540aced
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(72,@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-20 10:12:52', '06ad720540aced', '72', '0.00', '1873', '0', '1', '1873.00', '1873', '0', '1873', '1', '2026-10-20 10:12:52', '', '1', '0', 'م /احمد سعد', '1', '1', '3', '0', 'م /احمد سعد', '10' ,'0','','','','','-1','0','0','0','0','0','1873','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=353
UPDATE client SET  clientdebt = '1873', userid = '1' WHERE clientid = '72';
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 ('72','0.00','1873','0','اضافة فاتورة مبيعات','353', '1873', '2026-10-20 10:12:52', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1873', '0', null, '0', null, null,'', '0','1','1','1873','1','2026-10-20 10:12:52','0','0','',''); -- id=599
UPDATE client SET  inUse = 0 where clientid = 72;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 210;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('480','00028', '353', '8', '28', '3', '550', '1650', '0', '', '1', '2026-10-20 10:12:53', '28', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','210-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=2827
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 479.44, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 479.44
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 479.44, lastbuyprice_withDiscountAndTax = 480
                where sellbilldetailid = 2827;
 INSERT INTO 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-20', 1650, 1440, 1440
                    , 1438.32, 1440, 1438.32, 1440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 1438.32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1438.32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1438.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1438.32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 1650, 1440, 1440
                    , 1438.32, 1440, 1438.32, 1440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1438.32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1438.32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1438.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1438.32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-20 10:12:53' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '3', '1', '353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '42', '1', '2026-10-20 10:12:53','0','0'); -- id=4997
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 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', '353', '12', '82', '6', '34', '204', '0', '', '1', '2026-10-20 10:12:53', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-6,','1','1','0','0','34','204','0','','0','0.00','0','0','0','0'); -- id=2828
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 = 2828;
 INSERT INTO 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-20', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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+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-20', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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 = '268', userid = '1', storedetaildate = '2026-10-20 10:12:53' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '1', '353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '274', '268', '1', '2026-10-20 10:12:53','0','0'); -- id=4998
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '353', '14', '81', '1', '19', '19', '0', '', '1', '2026-10-20 10:12:53', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=2829
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 = 2829;
 INSERT INTO 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-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-20 10:12:54' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '50', '1', '2026-10-20 10:12:54','0','0'); -- id=4999
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1873', '1873', '2026-10-20', '1', '0', '0', '2026-10-20 10:12:54','اضافة فاتورة مبيعات رقم 353','1','0',null,'0','353','sellbillController.php?do=showDetail&sellbillid=353'); -- id=1805
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1805', '505', '1873', '','0'); -- id=1821
UPDATE accountstree SET name = 'م /احمد سعد', customName = 'م /احمد سعد', customNameEn = 'م /احمد سعد', nameEn = 'م /احمد سعد', parent = '58', accountNature = '0', theValue = '1873', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 10:08:25' WHERE id = '505';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1805', '143', '1873', '','0'); -- id=1809
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1536120.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1642.8', '1642.8', '2026-10-20', '1', '0', '0', '2026-10-20 10:12:54','اضافة فاتورة مبيعات رقم 353 - صرف البضاعة من المخزن','1','0',null,'0','353','sellbillController.php?do=showDetail&sellbillid=353'); -- id=1806
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1806', '402', '1642.8', '','0'); -- id=1822
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1371017.1', 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 ('1806', '382', '1642.8', '','0'); -- id=1810
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2197422.5', 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='1805,0,1806' where sellbillid=353;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-20', 1873, 1642.8, 1642.8
                    , 1641.12, 1642.8, 1641.12, 1642.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1642.8, 1641.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1873, sellCostBuyPrice =sellCostBuyPrice+1642.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1642.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1641.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1642.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1641.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1642.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1642.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1641.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (72, '2026-10-20', 1873, 1642.8, 1642.8
                    , 1641.12, 1642.8, 1641.12, 1642.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1642.8, 1641.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1873, sellCostBuyPrice =sellCostBuyPrice+1642.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1642.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1641.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1642.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1641.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1642.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1642.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1641.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1873, 1642.8, 1642.8
                    , 1641.12, 1642.8, 1641.12, 1642.8, 1642.8, 1641.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1873, netSellCostBuyPrice = netSellCostBuyPrice+1642.8
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1642.8
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1641.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1642.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1641.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1642.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1642.8
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1641.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad720540aced and sellbillId = 353 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 06:42:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:12:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:12:55', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4687
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:01:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:31:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 10:31:33', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4688
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:01:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:31:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 10:31:47', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4689

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =600
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-20 10:31:48', userid = '1' WHERE clientid = '2';
UPDATE client SET  inUse = 0 where clientid = 2;
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 ('2','14001.70','14001.7','1','ايصال تحصيل (( قبض من عميل ))','600', '0', '2026-10-20 10:31:34', '1', 'clientPayedDeptController.php', '   ', '14001.7', '0', null, '0', null, null,'', '-1','1','1','14001.7','1','','63','0','','.'); -- id=600
UPDATE save SET  savecurrentvalue = '-816445.74',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-830447.44','14001.7', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '600', '-816445.74', '2026-10-20 10:31:48', '1',  'clientPayedDeptController.php','2','','0'); -- id=371
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14001.7', '14001.7', '2026-10-20', '1', '0', '0', '2026-10-20 10:31:48','اضافة ايصال سداد للعميل فؤاد الطوخي','1','0','0','0','600','clientPayedDeptController.php?do=show&id=600'); -- id=1807
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1807', '383', '14001.7', '','0'); -- id=1823
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '207094.54', 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 ('1807', '426', '14001.7', '','0'); -- id=1811
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-13 20:11:03' WHERE id = '426';
UPDATE clientdebtchange SET clientid = '2', clientdebtchangebefore = '14001.700', clientdebtchangeamount = '14001.700', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '600', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-20 10:31:34', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '14001.700',discount='', reciptid='0', dailyentryid = '1807',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='14001.7',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '600';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:01:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:31:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 10:31:49', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:01:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:31:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:31:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:03:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:33:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:33:41', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4692

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad726f81da91
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@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-20 10:33:42', '06ad726f81da91', '2', '0.00', '1220', '0', '1', '1220.00', '1220', '0', '1220', '1', '2026-10-20 10:33:42', '', '1', '0', 'فؤاد الطوخي', '1', '1', '3', '0', 'فؤاد الطوخي', '9' ,'0','','','','','-1','0','0','0','0','0','1220','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=354
UPDATE client SET  clientdebt = '1220', userid = '1' WHERE clientid = '2';
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 ('2','0.00','1220','0','اضافة فاتورة مبيعات','354', '1220', '2026-10-20 10:33:42', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1220', '0', null, '0', null, null,'', '0','1','1','1220','1','2026-10-20 10:33:42','0','0','',''); -- id=601
UPDATE client SET  inUse = 0 where clientid = 2;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15.5','00193', '354', '20', '193', '5', '16', '80', '0', '', '0', '2026-10-20 10:33:42', '193', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','16','80','0','','0','','0','0','0','0'); -- id=2830
UPDATE sellbilldetail SET  lastbuyprice = 15.50 , meanbuyprice = 15.50, lastbuyprice_withDiscount = 15.50, meanbuyprice_withDiscount = 15.50
        , lastbuyprice_withTax = 15.5, meanbuyprice_withTax = 15.5, lastbuyprice_withDiscountAndTax = 15.5
                where sellbilldetailid = 2830;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (193, '2026-10-20', 80, 77.5, 77.5
                    , 77.5, 77.5, 77.5, 77.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 77.5, 77.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+77.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 80, 77.5, 77.5
                    , 77.5, 77.5, 77.5, 77.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.5, 77.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+77.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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 = '107', userid = '1', storedetaildate = '2026-10-20 10:33:43' WHERE storedetailid = '193';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('193', '1', '5', '1', '354', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '107', '1', '2026-10-20 10:33:43','0','0'); -- id=5000
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 75;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00282', '354', '22', '282', '4', '285', '1140', '0', '', '0', '2026-10-20 10:33:43', '282', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','75-4,','1','1','0','0','285','1140','0','','0','0.00','0','0','0','0'); -- id=2831
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 2831;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (282, '2026-10-20', 1140, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1140, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 10:33:43' WHERE storedetailid = '282';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('282', '1', '4', '1', '354', 'اضافة فاتورة مبيعات', 'sellbillController.php', '22', '18', '1', '2026-10-20 10:33:43','0','0'); -- id=5001
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1220', '1220', '2026-10-20', '1', '0', '0', '2026-10-20 10:33:43','اضافة فاتورة مبيعات رقم 354','1','0',null,'0','354','sellbillController.php?do=showDetail&sellbillid=354'); -- id=1808
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1808', '426', '1220', '','0'); -- id=1824
UPDATE accountstree SET name = 'فؤاد الطوخي', customName = 'فؤاد الطوخي', customNameEn = 'فؤاد الطوخي', nameEn = 'فؤاد الطوخي', parent = '58', accountNature = '0', theValue = '1220', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-13 20:11:03' WHERE id = '426';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1808', '143', '1220', '','0'); -- id=1812
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1537340.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1177.5', '1177.5', '2026-10-20', '1', '0', '0', '2026-10-20 10:33:43','اضافة فاتورة مبيعات رقم 354 - صرف البضاعة من المخزن','1','0',null,'0','354','sellbillController.php?do=showDetail&sellbillid=354'); -- id=1809
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1809', '402', '1177.5', '','0'); -- id=1825
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1372194.6', 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 ('1809', '382', '1177.5', '','0'); -- id=1813
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2196245', 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='1808,0,1809' where sellbillid=354;
 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-20', 1220, 1177.5, 1177.5
                    , 1177.5, 1177.5, 1177.5, 1177.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1177.5, 1177.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1220, sellCostBuyPrice =sellCostBuyPrice+1177.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1177.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1177.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1177.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1177.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 (2, '2026-10-20', 1220, 1177.5, 1177.5
                    , 1177.5, 1177.5, 1177.5, 1177.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1177.5, 1177.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1220, sellCostBuyPrice =sellCostBuyPrice+1177.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1177.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1177.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1177.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1177.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, 1220, 1177.5, 1177.5
                    , 1177.5, 1177.5, 1177.5, 1177.5, 1177.5, 1177.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1220, netSellCostBuyPrice = netSellCostBuyPrice+1177.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1177.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1177.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1177.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1177.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1177.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1177.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1177.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad726f81da91 and sellbillId = 354 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:03:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:33:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:33:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:07:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:37:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:37:44', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4694
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 315;
UPDATE sellbill SET  sellbillsysdate = '2026-10-20 10:37:44', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '315';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 191;
UPDATE sellbilldetail SET  lastbuyprice = 3700.00 , meanbuyprice = 3700.00, lastbuyprice_withDiscount = 3700.00, meanbuyprice_withDiscount = 3700.00
        , lastbuyprice_withTax = 3700, meanbuyprice_withTax = 3700, lastbuyprice_withDiscountAndTax = 3700
                where sellbilldetailid = 2523;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (592, '2026-10-20', 7980, 7400, 7400
                    , 7400, 7400, 7400, 7400
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 7400, 7400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7980, sellCostBuyPrice =sellCostBuyPrice-7400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 7980, 7400, 7400
                    , 7400, 7400, 7400, 7400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7400, 7400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7980, sellCostBuyPrice =sellCostBuyPrice-7400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 10:37:44' WHERE storedetailid = '592';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('592', '1', '2', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '3', '1', '2026-10-17 09:19:17','0','0'); -- id=5002
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 138;
UPDATE sellbilldetail SET  lastbuyprice = 14.45 , meanbuyprice = 14.32, lastbuyprice_withDiscount = 14.45, meanbuyprice_withDiscount = 14.32
        , lastbuyprice_withTax = 14.45, meanbuyprice_withTax = 14.32, lastbuyprice_withDiscountAndTax = 14.45
                where sellbilldetailid = 2524;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-10-20', 204, 173.4, 173.4
                    , 171.84, 173.4, 171.84, 173.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 173.4, 171.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-173.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-173.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-171.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-173.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-171.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-173.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-173.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-171.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-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-20', 204, 173.4, 173.4
                    , 171.84, 173.4, 171.84, 173.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 173.4, 171.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-173.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-173.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-171.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-173.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-171.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-173.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-173.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-171.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 = '44', userid = '1', storedetaildate = '2026-10-20 10:37:44' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '12', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '44', '1', '2026-10-17 09:19:17','0','0'); -- id=5003
UPDATE sellbilldetail SET  lastbuyprice = 144.30 , meanbuyprice = 144.30, lastbuyprice_withDiscount = 144.30, meanbuyprice_withDiscount = 144.30
        , lastbuyprice_withTax = 144.3, meanbuyprice_withTax = 144.3, lastbuyprice_withDiscountAndTax = 144.3
                where sellbilldetailid = 2525;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (64, '2026-10-20', 1872, 1731.6, 1731.6
                    , 1731.6, 1731.6, 1731.6, 1731.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 1731.6, 1731.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1872, sellCostBuyPrice =sellCostBuyPrice-1731.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1731.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1731.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1731.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1731.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1731.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1731.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1731.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-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-20', 1872, 1731.6, 1731.6
                    , 1731.6, 1731.6, 1731.6, 1731.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1731.6, 1731.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1872, sellCostBuyPrice =sellCostBuyPrice-1731.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1731.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1731.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1731.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1731.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1731.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1731.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1731.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 = '31', userid = '1', storedetaildate = '2026-10-20 10:37:45' WHERE storedetailid = '64';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('64', '1', '12', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '31', '1', '2026-10-17 09:19:17','0','0'); -- id=5004
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 = 2526;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (343, '2026-10-20', 240, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-240, 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-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-20', 240, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-240, 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 = '23', userid = '1', storedetaildate = '2026-10-20 10:37:45' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '6', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '23', '1', '2026-10-17 09:19:17','0','0'); -- id=5005
UPDATE sellbilldetail SET  lastbuyprice = 17.85 , meanbuyprice = 17.85, lastbuyprice_withDiscount = 17.85, meanbuyprice_withDiscount = 17.85
        , lastbuyprice_withTax = 17.85, meanbuyprice_withTax = 17.85, lastbuyprice_withDiscountAndTax = 17.85
                where sellbilldetailid = 2527;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (599, '2026-10-20', 95, 89.25, 89.25
                    , 89.25, 89.25, 89.25, 89.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 89.25, 89.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-95, sellCostBuyPrice =sellCostBuyPrice-89.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 95, 89.25, 89.25
                    , 89.25, 89.25, 89.25, 89.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.25, 89.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-95, sellCostBuyPrice =sellCostBuyPrice-89.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '214', userid = '1', storedetaildate = '2026-10-20 10:37:45' WHERE storedetailid = '599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('599', '1', '5', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '209', '214', '1', '2026-10-17 09:19:17','0','0'); -- id=5006
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2528;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-20', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.25,0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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-0.25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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 = '5.9', userid = '1', storedetaildate = '2026-10-20 10:37:45' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5.65', '5.9', '1', '2026-10-17 09:19:17','0','0'); -- id=5007
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
        , lastbuyprice_withTax = 210, meanbuyprice_withTax = 210, lastbuyprice_withDiscountAndTax = 210
                where sellbilldetailid = 2529;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (346, '2026-10-20', 460, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-460, sellCostBuyPrice =sellCostBuyPrice-420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-420, sellCostMeanBuyPrice = sellCostMeanBuyPrice-420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-420
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 460, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-460, sellCostBuyPrice =sellCostBuyPrice-420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-420, sellCostMeanBuyPrice = sellCostMeanBuyPrice-420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-420
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-20 10:37:45' WHERE storedetailid = '346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('346', '1', '2', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '8', '10', '1', '2026-10-17 09:19:17','0','0'); -- id=5008
UPDATE sellbilldetail SET  lastbuyprice = 398.00 , meanbuyprice = 398.00, lastbuyprice_withDiscount = 398.00, meanbuyprice_withDiscount = 398.00
        , lastbuyprice_withTax = 398, meanbuyprice_withTax = 398, lastbuyprice_withDiscountAndTax = 398
                where sellbilldetailid = 2530;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (557, '2026-10-20', 425, 398, 398
                    , 398, 398, 398, 398
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 398, 398, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-425, sellCostBuyPrice =sellCostBuyPrice-398
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-398, sellCostMeanBuyPrice = sellCostMeanBuyPrice-398
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-398, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-398
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-398
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-398
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-398
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 425, 398, 398
                    , 398, 398, 398, 398
                    , 0, 0, 0, 0
                    , 0, 0, 0, 398, 398, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-425, sellCostBuyPrice =sellCostBuyPrice-398
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-398, sellCostMeanBuyPrice = sellCostMeanBuyPrice-398
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-398, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-398
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-398
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-398
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-398
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 10:37:45' WHERE storedetailid = '557';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('557', '1', '1', '0', '315', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-10-17 09:19:17','0','0'); -- id=5009
CALL clientInUse(41,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '41';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('41','4899.75','4899.75','1','تعديل فاتورة مبيعات','315', '0', '2026-10-17 09:19:17', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '11299.75', '0', null, '0', null, null,'', '0','1','1','4899.75','1','2026-10-17 09:19:17','0','0','',''); -- id=602
UPDATE client SET  inUse = 0 where clientid = 41;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-822845.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 ('-816445.75','6400', '1', '1', 'تعديل فاتورة مبيعات', '315', '-822845.75', '2026-10-20 10:37:45', '1',  'sellbillController.php','41','','0'); -- id=372
 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-20', 11299.75, 10442.75, 10442.75
                    , 10441.19, 10442.75, 10441.19, 10442.75
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10442.75, 10441.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11299.75, sellCostBuyPrice =sellCostBuyPrice-10442.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10442.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10441.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10442.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10441.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10442.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10442.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10441.19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-20', 11299.75, 10442.75, 10442.75
                    , 10441.19, 10442.75, 10441.19, 10442.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10442.75, 10441.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11299.75, sellCostBuyPrice =sellCostBuyPrice-10442.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10442.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10441.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10442.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10441.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10442.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10442.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10441.19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 11299.75, 10442.75, 10442.75
                    , 10441.19, 10442.75, 10441.19, 10442.75, 10442.75, 10441.19)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-11299.75, netSellCostBuyPrice = netSellCostBuyPrice-10442.75
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-10442.75
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-10441.19
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-10442.75
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-10441.19
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-10442.75
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-10442.75
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-10441.19;

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


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

COMMIT;
BEGIN;
CALL clientInUse(41,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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-17 09:19:17', '06ad320a5b3e6f', '41', '0.00', '7756.75', '0', '1', '14156.75', '14156.75', '6400', '7756.75', '1', '2026-10-17 09:19:17', '', '1', '0', 'احمد سعد', '1', '1', '3', '0', 'احمد سعد', '52.25', '315', 'sellbillController', '0','','','','','-1','0','0','6400','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-17','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=355
UPDATE client SET  clientdebt = '7756.75', userid = '1' WHERE clientid = '41';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('41','0.00','7756.75','0','اضافة فاتورة مبيعات (معدله)','355', '7756.75', '2026-10-20 10:37:46', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '14156.75', '0', null, '0', null, null,'', '0','1','1','4899.75','1','2026-10-17 09:19:17','0','0','',''); -- id=603
UPDATE client SET  inUse = 0 where clientid = 41;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 191;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 221;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('3700','00592', '355', '1', '592', '2.00', '3990', '7980', '0', '', '1', '2026-10-20 10:37:46', '592', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','191-1,221-1,','1','1','0','0','3990','7980','0','','0','0.00','0','0','0','0'); -- id=2832
UPDATE sellbilldetail SET  lastbuyprice = 3700.00 , meanbuyprice = 3700.00, lastbuyprice_withDiscount = 3700.00, meanbuyprice_withDiscount = 3700.00
        , lastbuyprice_withTax = 3700, meanbuyprice_withTax = 3700, lastbuyprice_withDiscountAndTax = 3700
                where sellbilldetailid = 2832;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (592, '2026-10-20', 7980, 7400, 7400
                    , 7400, 7400, 7400, 7400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 7400, 7400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7980, sellCostBuyPrice =sellCostBuyPrice+7400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 7980, 7400, 7400
                    , 7400, 7400, 7400, 7400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7400, 7400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7980, sellCostBuyPrice =sellCostBuyPrice+7400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-20 10:37:47' WHERE storedetailid = '592';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('592', '1', '2', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '1', '1', '2026-10-20 10:37:47','0','0'); -- id=5010
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 138;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14.45','00416', '355', '6', '416', '12.00', '17', '204', '0', '', '1', '2026-10-20 10:37:47', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','138-12,','1','1','0','0','17','204','0','','0','0.00','0','0','0','0'); -- id=2833
UPDATE sellbilldetail SET  lastbuyprice = 14.45 , meanbuyprice = 14.32, lastbuyprice_withDiscount = 14.45, meanbuyprice_withDiscount = 14.32
        , lastbuyprice_withTax = 14.45, meanbuyprice_withTax = 14.32, lastbuyprice_withDiscountAndTax = 14.45
                where sellbilldetailid = 2833;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-10-20', 204, 173.4, 173.4
                    , 171.84, 173.4, 171.84, 173.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 173.4, 171.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+173.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+173.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+171.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+173.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+171.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+173.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+173.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+171.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+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-20', 204, 173.4, 173.4
                    , 171.84, 173.4, 171.84, 173.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 173.4, 171.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+173.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+173.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+171.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+173.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+171.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+173.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+173.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+171.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 = '32', userid = '1', storedetaildate = '2026-10-20 10:37:47' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '12', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '32', '1', '2026-10-20 10:37:47','0','0'); -- id=5011
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('144.3','00064', '355', '1', '64', '12.00', '156', '1872', '0', '', '1', '2026-10-20 10:37:47', '64', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','156','1872','0','','0','0.00','0','0','0','0'); -- id=2834
UPDATE sellbilldetail SET  lastbuyprice = 144.30 , meanbuyprice = 144.30, lastbuyprice_withDiscount = 144.30, meanbuyprice_withDiscount = 144.30
        , lastbuyprice_withTax = 144.3, meanbuyprice_withTax = 144.3, lastbuyprice_withDiscountAndTax = 144.3
                where sellbilldetailid = 2834;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (64, '2026-10-20', 1872, 1731.6, 1731.6
                    , 1731.6, 1731.6, 1731.6, 1731.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 1731.6, 1731.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1872, sellCostBuyPrice =sellCostBuyPrice+1731.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1731.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1731.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1731.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1731.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1731.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1731.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1731.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+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-20', 1872, 1731.6, 1731.6
                    , 1731.6, 1731.6, 1731.6, 1731.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1731.6, 1731.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1872, sellCostBuyPrice =sellCostBuyPrice+1731.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1731.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1731.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1731.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1731.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1731.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1731.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1731.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 = '19', userid = '1', storedetaildate = '2026-10-20 10:37:47' WHERE storedetailid = '64';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('64', '1', '12', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '31', '19', '1', '2026-10-20 10:37:47','0','0'); -- id=5012
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35','00343', '355', '6', '343', '6.00', '40', '240', '0', '', '1', '2026-10-20 10:37:47', '343', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','40','240','0','','0','0.00','0','0','0','0'); -- id=2835
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 = 2835;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (343, '2026-10-20', 240, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, 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+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-20', 240, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, 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 = '17', userid = '1', storedetaildate = '2026-10-20 10:37:48' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '6', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '23', '17', '1', '2026-10-20 10:37:48','0','0'); -- id=5013
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.85','00599', '355', '6', '599', '5.00', '19', '95', '0', '', '1', '2026-10-20 10:37:48', '599', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','95','0','','0','0.00','0','0','0','0'); -- id=2836
UPDATE sellbilldetail SET  lastbuyprice = 17.85 , meanbuyprice = 17.85, lastbuyprice_withDiscount = 17.85, meanbuyprice_withDiscount = 17.85
        , lastbuyprice_withTax = 17.85, meanbuyprice_withTax = 17.85, lastbuyprice_withDiscountAndTax = 17.85
                where sellbilldetailid = 2836;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (599, '2026-10-20', 95, 89.25, 89.25
                    , 89.25, 89.25, 89.25, 89.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 89.25, 89.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+89.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 95, 89.25, 89.25
                    , 89.25, 89.25, 89.25, 89.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.25, 89.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+89.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '209', userid = '1', storedetaildate = '2026-10-20 10:37:48' WHERE storedetailid = '599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('599', '1', '5', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '214', '209', '1', '2026-10-20 10:37:48','0','0'); -- id=5014
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '355', '14', '80', '0.25', '95', '23.75', '0', '', '1', '2026-10-20 10:37:48', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=2837
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2837;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-20', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '5.65', userid = '1', storedetaildate = '2026-10-20 10:37:48' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5.9', '5.65', '1', '2026-10-20 10:37:48','0','0'); -- id=5015
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('210','00346', '355', '6', '346', '2.00', '230', '460', '0', '', '1', '2026-10-20 10:37:49', '346', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','230','460','0','','0','0.00','0','0','0','0'); -- id=2838
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
        , lastbuyprice_withTax = 210, meanbuyprice_withTax = 210, lastbuyprice_withDiscountAndTax = 210
                where sellbilldetailid = 2838;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (346, '2026-10-20', 460, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 460, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-20 10:37:49' WHERE storedetailid = '346';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('346', '1', '2', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '8', '1', '2026-10-20 10:37:49','0','0'); -- id=5016
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('398','00557', '355', '1', '557', '1.00', '425', '425', '0', '', '1', '2026-10-20 10:37:49', '557', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','425','425','0','','0','0.00','0','0','0','0'); -- id=2839
UPDATE sellbilldetail SET  lastbuyprice = 398.00 , meanbuyprice = 398.00, lastbuyprice_withDiscount = 398.00, meanbuyprice_withDiscount = 398.00
        , lastbuyprice_withTax = 398, meanbuyprice_withTax = 398, lastbuyprice_withDiscountAndTax = 398
                where sellbilldetailid = 2839;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (557, '2026-10-20', 425, 398, 398
                    , 398, 398, 398, 398
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 398, 398, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+425, sellCostBuyPrice =sellCostBuyPrice+398
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+398, sellCostMeanBuyPrice = sellCostMeanBuyPrice+398
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+398, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+398
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+398
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+398
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+398
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 425, 398, 398
                    , 398, 398, 398, 398
                    , 0, 0, 0, 0
                    , 0, 0, 0, 398, 398, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+425, sellCostBuyPrice =sellCostBuyPrice+398
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+398, sellCostMeanBuyPrice = sellCostMeanBuyPrice+398
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+398, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+398
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+398
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+398
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+398
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 10:37:49' WHERE storedetailid = '557';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('557', '1', '1', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-10-20 10:37:49','0','0'); -- id=5017
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 220;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('262','00065', '355', '1', '65', '9', '285', '2565', '0', '', '1', '2026-10-20 10:37:49', '65', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','220-9,','1','1','0','0','285','2565','0','','0','0.00','0','0','0','0'); -- id=2840
UPDATE sellbilldetail SET  lastbuyprice = 262.00 , meanbuyprice = 262.00, lastbuyprice_withDiscount = 262.00, meanbuyprice_withDiscount = 262.00
        , lastbuyprice_withTax = 262, meanbuyprice_withTax = 262, lastbuyprice_withDiscountAndTax = 262
                where sellbilldetailid = 2840;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (65, '2026-10-20', 2565, 2358, 2358
                    , 2358, 2358, 2358, 2358
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2358, 2358, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2565, sellCostBuyPrice =sellCostBuyPrice+2358
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2358, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2358
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2358, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2358
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2358
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2358
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2358
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 2565, 2358, 2358
                    , 2358, 2358, 2358, 2358
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2358, 2358, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2565, sellCostBuyPrice =sellCostBuyPrice+2358
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2358, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2358
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2358, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2358
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2358
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2358
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2358
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 10:37:50' WHERE storedetailid = '65';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('65', '1', '9', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '28', '19', '1', '2026-10-20 10:37:50','0','0'); -- id=5018
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 139;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00450', '355', '6', '450', '1', '20', '20', '0', '', '1', '2026-10-20 10:37:50', '450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','139-1,','1','1','0','0','20','20','0','','0','0.00','0','0','0','0'); -- id=2841
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 2841;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (450, '2026-10-20', 20, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 20, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-10-20 10:37:50' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '1', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '43', '1', '2026-10-20 10:37:50','0','0'); -- id=5019
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('129.7','00059', '355', '1', '59', '2', '136', '272', '0', '', '1', '2026-10-20 10:37:50', '59', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','272','0','','0','0.00','0','0','0','0'); -- id=2842
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 2842;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (59, '2026-10-20', 272, 259.4, 259.4
                    , 259.4, 259.4, 259.4, 259.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 259.4, 259.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+272, sellCostBuyPrice =sellCostBuyPrice+259.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+259.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+259.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+259.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+259.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+259.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+259.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+259.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 272, 259.4, 259.4
                    , 259.4, 259.4, 259.4, 259.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 259.4, 259.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+272, sellCostBuyPrice =sellCostBuyPrice+259.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+259.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+259.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+259.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+259.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+259.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+259.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+259.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '167', userid = '1', storedetaildate = '2026-10-20 10:37:50' WHERE storedetailid = '59';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '1', '2', '1', '355', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '169', '167', '1', '2026-10-20 10:37:50','0','0'); -- id=5020
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-816445.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 ('-822845.75','6400', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '355', '-816445.75', '2026-10-20 10:37:50', '1',  'sellbillController.php','41','','0'); -- id=373
UPDATE dailyentry SET totalcreditor = '11299.75', totaldebtor = '11299.75', thedate = '2026-10-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-17 09:19:21', entryComment = 'اضافة فاتورة مبيعات رقم 315', fromFlag = '1',related='0',isopeningentry='0',operationId='315',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=315' WHERE id = '1682';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11299.75', '11299.75', '2026-10-20', '1', '0', '1682', '2026-10-20 10:37:51','تم عكس القيد رقم 1682 ','1','0','0','0','0',''); -- id=1810
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1810', '473', '11299.75', '','0'); -- id=1814
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '-6400', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1810', '143', '11299.75', '','0'); -- id=1826
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1526041.15', 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 = '6400.00', totaldebtor = '6400.00', thedate = '2026-10-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-17 09:19:21', entryComment = 'اضافة فاتورة مبيعات رقم 315 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='315',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=315' WHERE id = '1683';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6400.00', '6400.00', '2026-10-20', '1', '0', '1683', '2026-10-20 10:37:51','تم عكس القيد رقم 1683 ','1','0','0','0','0',''); -- id=1811
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1811', '383', '6400.00', '','0'); -- id=1815
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '200694.54', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1811', '473', '6400.00', '','0'); -- id=1827
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 dailyentry SET totalcreditor = '10442.75', totaldebtor = '10442.75', thedate = '2026-10-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-17 09:19:21', entryComment = 'اضافة فاتورة مبيعات رقم 315 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='315',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=315' WHERE id = '1684';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10442.75', '10442.75', '2026-10-20', '1', '0', '1684', '2026-10-20 10:37:52','تم عكس القيد رقم 1684 ','1','0','0','0','0',''); -- id=1812
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1812', '402', '10442.75', '','0'); -- id=1816
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1361751.85', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1812', '382', '10442.75', '','0'); -- id=1828
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2206687.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14156.75', '14156.75', '2026-10-20', '1', '0', '0', '2026-10-20 10:37:52','اضافة فاتورة مبيعات رقم 355','1','0',null,'0','355','sellbillController.php?do=showDetail&sellbillid=355'); -- id=1813
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1813', '473', '14156.75', '','0'); -- id=1829
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '14156.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1813', '143', '14156.75', '','0'); -- id=1817
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1540197.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6400', '6400', '2026-10-20', '1', '0', '0', '2026-10-20 10:37:52','اضافة فاتورة مبيعات رقم 355 - تحصيل الفاتورة من العميل','1','0',null,'0','355','sellbillController.php?do=showDetail&sellbillid=355'); -- id=1814
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1814', '383', '6400', '','0'); -- id=1830
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '207094.54', 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 ('1814', '473', '6400', '','0'); -- id=1818
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '7756.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13077.75', '13077.75', '2026-10-20', '1', '0', '0', '2026-10-20 10:37:52','اضافة فاتورة مبيعات رقم 355 - صرف البضاعة من المخزن','1','0',null,'0','355','sellbillController.php?do=showDetail&sellbillid=355'); -- id=1815
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1815', '402', '13077.75', '','0'); -- id=1831
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1374829.6', 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 ('1815', '382', '13077.75', '','0'); -- id=1819
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2193610', 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='1813,1814,1815' where sellbillid=355;
 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-20', 14156.75, 13077.75, 13077.75
                    , 13076.19, 13077.75, 13076.19, 13077.75
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13077.75, 13076.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14156.75, sellCostBuyPrice =sellCostBuyPrice+13077.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13077.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13076.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13077.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13076.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13077.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13077.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13076.19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-20', 14156.75, 13077.75, 13077.75
                    , 13076.19, 13077.75, 13076.19, 13077.75
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13077.75, 13076.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14156.75, sellCostBuyPrice =sellCostBuyPrice+13077.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13077.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13076.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13077.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13076.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13077.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13077.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13076.19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 14156.75, 13077.75, 13077.75
                    , 13076.19, 13077.75, 13076.19, 13077.75, 13077.75, 13076.19)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14156.75, netSellCostBuyPrice = netSellCostBuyPrice+13077.75
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13077.75
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13076.19
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13077.75
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13076.19
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13077.75
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+13077.75
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13076.19;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 315 and newid=355 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 07:07:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 10:37:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 10:37:54', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=355'); -- id=4695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:03:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:33:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:33:46', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:03:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:33:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:33:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4697
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:04:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:34:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:34:01', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=339'); -- id=4698
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:04:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:34:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:34:11', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4699
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 339;
UPDATE sellbill SET  sellbillsysdate = '2026-10-20 11:34:11', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '339';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 197;
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 79.95, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 79.95
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 79.95, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 2704;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (387, '2026-10-20', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-930, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-799.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-930, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-799.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-20 11:34:12' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '0', '339', 'تعديل فاتورة مبيعات', 'sellbillController.php', '26', '36', '1', '2026-10-19 12:08:06','0','0'); -- id=5021
CALL clientInUse(9,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '3868.75', userid = '1' WHERE clientid = '9';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('9','4798.75','930.00','1','تعديل فاتورة مبيعات','339', '3868.75', '2026-10-19 12:08:06', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '930', '0', null, '0', null, null,'', '0','1','1','930','1','2026-10-19 12:08:06','0','0','',''); -- id=604
UPDATE client SET  inUse = 0 where clientid = 9;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-20', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-930, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-799.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-20', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-930, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-799.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 930, 800, 800
                    , 799.5, 800, 799.5, 800, 800, 799.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-930, netSellCostBuyPrice = netSellCostBuyPrice-800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-799.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-800
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-799.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-800
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-799.5;

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


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

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

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 339 and newid=356 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:04:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:34:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:34:15', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=356'); -- id=4700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 08:04:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 11:34:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 11:34:26', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 09:49:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:19:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 13:19:19', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4702
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 09:51:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:21:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 13:21:13', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4703
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 ('06ad74e38b17bd', '2026-10-20 13:19:20', '1', '81528.92', '81528.92', '0', '0', '28410.00',  '28410.00', '28410', '0', '1', '2026-10-20 13:21:13', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=63
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 ('00102', '63', '3', '102', '600', '11.75', '7050.00', '0', '', '2026-10-20 13:21:13', '102','','','0','0','0','0','0',null,'11.75','7050','0','0','0','0','0','0','0','0','1'); -- id=232
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 13:19:20', 1, 102, 0, 0
                    , 11.75, 600, 0, 0, 1, '2026-10-20 13:21:14')
                ON DUPLICATE KEY UPDATE buyprice = 11.75,
                        buyQuantity =buyQuantity+600, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 13:21:14' ; -- id=232
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('102', '11.75', '600', '0', 'buyBillController.php', '232', '', '0', '0'); -- id=232
UPDATE product SET  productBuyPrice = "11.75" WHERE productId = 102 ;
UPDATE buybilldetail SET  quantitybefore = 1360 WHERE buybilldetailid = 232 ;
UPDATE product SET productName = 'شاسيه ', productDescription = '', productCatId = '3', productBuyPrice = '11.75', productSellAllPrice = '12.00', productSellUnitPrice = '12.00', productSellHalfPrice = '12.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '300', parcode = '00102',type ='0', expireDate = '0' , dailyentryId = '112',isService = '0',isOptic = '0',lastbuyprice = '11.75',lastbuyprice_withDiscount = '11.75',meanbuyprice = '11.75',meanbuyprice_withDiscount = '11.75' , productbuypricereal = '11.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.13' , buyhalf_precentage = '2.13' , buypart_precentage = '2.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='11.75',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='11.75',meanbuyprice_withTax='11.75',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='11.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '102';
UPDATE buybilldetail 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 buybilldetailid = 232;
UPDATE productunit SET proUnitBuyPrice  = 11.75 * productnumber WHERE productid = 102;
UPDATE storedetail SET  productquantity = '1960', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '600', '0', '63', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1360', '1960', '1', '2026-10-20 13:19:20','0','0'); -- id=5023
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 ('00103', '63', '3', '103', '2400', '4.5', '10800.00', '0', '', '2026-10-20 13:21:13', '103','','','0','0','0','0','0',null,'4.5','10800','0','0','0','0','0','0','0','0','1'); -- id=233
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 13:19:20', 1, 103, 0, 0
                    , 4.5, 2400, 0, 0, 1, '2026-10-20 13:21:14')
                ON DUPLICATE KEY UPDATE buyprice = 4.5,
                        buyQuantity =buyQuantity+2400, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 13:21:14' ; -- id=233
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('103', '4.5', '2400', '0', 'buyBillController.php', '233', '', '0', '0'); -- id=233
UPDATE product SET  productBuyPrice = "4.5" WHERE productId = 103 ;
UPDATE buybilldetail SET  quantitybefore = 1050 WHERE buybilldetailid = 233 ;
UPDATE product SET productName = 'سداده', productDescription = '', productCatId = '3', productBuyPrice = '4.50', productSellAllPrice = '5.50', productSellUnitPrice = '5.50', productSellHalfPrice = '5.50', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '200', parcode = '00103',type ='0', expireDate = '0' , dailyentryId = '113',isService = '0',isOptic = '0',lastbuyprice = '4.5',lastbuyprice_withDiscount = '4.5',meanbuyprice = '4.5',meanbuyprice_withDiscount = '4.5' , productbuypricereal = '4.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '22.22' , buyhalf_precentage = '22.22' , buypart_precentage = '22.22',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='4.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='4.5',meanbuyprice_withTax='4.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='4.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 = '103';
UPDATE buybilldetail SET  lastbuyprice = 4.5 , meanbuyprice = 4.5, lastbuyprice_withDiscount = 4.5, meanbuyprice_withDiscount = 4.5
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where buybilldetailid = 233;
UPDATE productunit SET proUnitBuyPrice  = 4.5 * productnumber WHERE productid = 103;
UPDATE storedetail SET  productquantity = '3450', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '2400', '0', '63', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1050', '3450', '1', '2026-10-20 13:19:20','0','0'); -- id=5024
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 ('00100', '63', '3', '100', '300', '17.6', '5280.00', '0', '', '2026-10-20 13:21:13', '100','','','0','0','0','0','0',null,'17.6','5280','0','0','0','0','0','0','0','0','1'); -- id=234
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 13:19:20', 1, 100, 0, 0
                    , 17.6, 300, 0, 0, 1, '2026-10-20 13:21:15')
                ON DUPLICATE KEY UPDATE buyprice = 17.6,
                        buyQuantity =buyQuantity+300, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 13:21:15' ; -- id=234
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('100', '17.6', '300', '0', 'buyBillController.php', '234', '', '0', '0'); -- id=234
UPDATE product SET  productBuyPrice = "17.6" WHERE productId = 100 ;
UPDATE buybilldetail SET  quantitybefore = 363 WHERE buybilldetailid = 234 ;
UPDATE product SET productName = 'مفتاح مفرد ', productDescription = '', productCatId = '3', productBuyPrice = '17.60', productSellAllPrice = '17.75', productSellUnitPrice = '17.75', productSellHalfPrice = '17.75', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '100', parcode = '00100',type ='0', expireDate = '0' , dailyentryId = '110',isService = '0',isOptic = '0',lastbuyprice = '17.6',lastbuyprice_withDiscount = '17.6',meanbuyprice = '17.6',meanbuyprice_withDiscount = '17.6' , productbuypricereal = '17.60' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.85' , buyhalf_precentage = '0.85' , buypart_precentage = '0.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='17.6',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='17.6',meanbuyprice_withTax='17.6',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='17.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '100';
UPDATE buybilldetail SET  lastbuyprice = 17.6 , meanbuyprice = 17.6, lastbuyprice_withDiscount = 17.6, meanbuyprice_withDiscount = 17.6
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where buybilldetailid = 234;
UPDATE productunit SET proUnitBuyPrice  = 17.6 * productnumber WHERE productid = 100;
UPDATE storedetail SET  productquantity = '663', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '300', '0', '63', 'اضافة فاتورة مشتريات', 'buyBillController.php', '363', '663', '1', '2026-10-20 13:19:20','0','0'); -- id=5025
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 ('00101', '63', '3', '101', '300', '17.6', '5280.00', '0', '', '2026-10-20 13:21:13', '101','','','0','0','0','0','0',null,'17.6','5280','0','0','0','0','0','0','0','0','1'); -- id=235
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 13:19:20', 1, 101, 0, 0
                    , 17.6, 300, 0, 0, 1, '2026-10-20 13:21:16')
                ON DUPLICATE KEY UPDATE buyprice = 17.6,
                        buyQuantity =buyQuantity+300, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 13:21:16' ; -- id=235
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('101', '17.6', '300', '0', 'buyBillController.php', '235', '', '0', '0'); -- id=235
UPDATE product SET  productBuyPrice = "17.6" WHERE productId = 101 ;
UPDATE buybilldetail SET  quantitybefore = 246 WHERE buybilldetailid = 235 ;
UPDATE product SET productName = 'بريزه مفرد', productDescription = '', productCatId = '3', productBuyPrice = '17.60', productSellAllPrice = '17.75', productSellUnitPrice = '17.75', productSellHalfPrice = '17.75', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '100', parcode = '00101',type ='0', expireDate = '0' , dailyentryId = '111',isService = '0',isOptic = '0',lastbuyprice = '17.6',lastbuyprice_withDiscount = '17.6',meanbuyprice = '17.6',meanbuyprice_withDiscount = '17.6' , productbuypricereal = '17.60' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.85' , buyhalf_precentage = '0.85' , buypart_precentage = '0.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='17.6',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='17.6',meanbuyprice_withTax='17.6',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='17.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '101';
UPDATE buybilldetail SET  lastbuyprice = 17.6 , meanbuyprice = 17.6, lastbuyprice_withDiscount = 17.6, meanbuyprice_withDiscount = 17.6
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where buybilldetailid = 235;
UPDATE productunit SET proUnitBuyPrice  = 17.6 * productnumber WHERE productid = 101;
UPDATE storedetail SET  productquantity = '546', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '300', '0', '63', 'اضافة فاتورة مشتريات', 'buyBillController.php', '246', '546', '1', '2026-10-20 13:19:20','0','0'); -- id=5026
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-20 13:21:13'   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', 'اضافة فاتورة مشتريات', '63', '81528.92', '2026-10-20 13:19:20', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=108
UPDATE save SET  savecurrentvalue = '-844855.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-816445.75','28410', '1', '1', 'اضافة فاتورة مشتريات', '63', '-844855.75', '2026-10-20 13:19:20', '1',  'buyBillController.php','0','','0'); -- id=374
update buybill set dailyentryid='0,0' where buybillid=63;
COMMIT;
UPDATE product SET overAllAveragePrice = 17.6 WHERE productId = 100;UPDATE product SET overAllAveragePrice = 17.6 WHERE productId = 101;UPDATE product SET overAllAveragePrice = 11.75 WHERE productId = 102;UPDATE product SET overAllAveragePrice = 4.5 WHERE productId = 103;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 09:51:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:21:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 13:21:18', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=63'); -- id=4704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 09:51:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:21:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 13:21:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 10:14:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-20 13:44:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 10:15:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-20 13:45:21', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4707
UPDATE storedetail SET  productquantity = '659', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '663', '659', '1', '2026-10-20','0','0'); -- id=5027
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '70.4', '70.4', '2026-10-20', '1', '0', '0', '2026-10-20 13:45:21','اعادة جرد للمنتج : (مفتاح مفرد /فينوس) فى مخزن : (المخزن الرئيسي) بالكمية : 659','1','0',null,'0','5027','inventoryController.php?do=details&id=5027'); -- id=1820
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1820', '188', '70.4', '','0'); -- id=1836
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-69267.5', 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 ('1820', '382', '70.4', '','0'); -- id=1824
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194259.6', 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-20 10:16:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:46:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-20 13:46:03', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4708
UPDATE storedetail SET  productquantity = '564', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '546', '564', '1', '2026-10-20','0','0'); -- id=5028
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '316.8', '316.8', '2026-10-20', '1', '0', '0', '2026-10-20 13:46:04','اعادة جرد للمنتج : (بريزه مفرد/فينوس) فى مخزن : (المخزن الرئيسي) بالكمية : 564','1','0',null,'0','5028','inventoryController.php?do=details&id=5028'); -- id=1821
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1821', '382', '316.8', '','0'); -- id=1837
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194576.4', 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 ('1821', '188', '316.8', '','0'); -- id=1825
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-69584.3', 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-20 10:16:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 13:46:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 13:46:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4709
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-20 14:29:47', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=73
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('73', '0', '0', '', ''); -- id=73
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 ('73','0','0','0','إضافة عميل جديد','73', '0', '2026-10-20 14:29:47', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=606
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-20 14:29:48'); -- id=506
UPDATE client SET clientname = 'الحاج/مصطفي الجبالي', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='506',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 = '73';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:00:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:30:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:30:21', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4710

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad7547d957a3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(73,@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-20 14:30:21', '06ad7547d957a3', '73', '0.00', '89', '0', '1', '117.00', '117', '28', '89', '1', '2026-10-20 14:30:21', '', '1', '0', 'الحاج/مصطفي الجبالي', '1', '1', '3', '0', 'الحاج/مصطفي الجبالي', '3.2' ,'0','','','','','-1','0','0','0','0','0','117','0','','0','0','28','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=357
UPDATE client SET  clientdebt = '89', userid = '1' WHERE clientid = '73';
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 ('73','0.00','89','0','اضافة فاتورة مبيعات','357', '89', '2026-10-20 14:30:22', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '117', '0', null, '0', null, null,'', '0','1','1','89','1','2026-10-20 14:30:21','0','0','',''); -- id=607
UPDATE client SET  inUse = 0 where clientid = 73;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '357', '12', '83', '2', '45', '90', '0', '', '1', '2026-10-20 14:30:22', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-2,','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=2844
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 = 2844;
 INSERT INTO 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-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-10-20 14:30:22' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '225', '223', '1', '2026-10-20 14:30:22','0','0'); -- id=5029
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.5','00419', '357', '6', '419', '1', '8', '8', '0', '', '1', '2026-10-20 14:30:22', '419', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','8','0','','0','0.00','0','0','0','0'); -- id=2845
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 2845;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-20 14:30:23' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '1', '357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29', '28', '1', '2026-10-20 14:30:23','0','0'); -- id=5030
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '357', '14', '80', '.2', '95', '19', '0', '', '1', '2026-10-20 14:30:23', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','19','0','','0','0.00','0','0','0','0'); -- id=2846
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2846;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.2, 0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.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-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5.45', userid = '1', storedetaildate = '2026-10-20 14:30:23' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.2', '1', '357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5.65', '5.45', '1', '2026-10-20 14:30:23','0','0'); -- id=5031
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-844827.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 ('-844855.75','28', '0', '1', 'اضافة فاتورة مبيعات', '357', '-844827.75', '2026-10-20 14:30:23', '1',  'sellbillController.php','73','','0'); -- id=375
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '117', '117', '2026-10-20', '1', '0', '0', '2026-10-20 14:30:23','اضافة فاتورة مبيعات رقم 357','1','0',null,'0','357','sellbillController.php?do=showDetail&sellbillid=357'); -- id=1822
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1822', '506', '117', '','0'); -- id=1838
UPDATE accountstree SET name = 'الحاج/مصطفي الجبالي', customName = 'الحاج/مصطفي الجبالي', customNameEn = 'الحاج/مصطفي الجبالي', nameEn = 'الحاج/مصطفي الجبالي', parent = '58', accountNature = '0', theValue = '117', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 14:29:48' WHERE id = '506';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1822', '143', '117', '','0'); -- id=1826
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1539477.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '28', '28', '2026-10-20', '1', '0', '0', '2026-10-20 14:30:23','اضافة فاتورة مبيعات رقم 357 - تحصيل الفاتورة من العميل','1','0',null,'0','357','sellbillController.php?do=showDetail&sellbillid=357'); -- id=1823
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1823', '383', '28', '','0'); -- id=1839
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '207122.54', 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 ('1823', '506', '28', '','0'); -- id=1827
UPDATE accountstree SET name = 'الحاج/مصطفي الجبالي', customName = 'الحاج/مصطفي الجبالي', customNameEn = 'الحاج/مصطفي الجبالي', nameEn = 'الحاج/مصطفي الجبالي', parent = '58', accountNature = '0', theValue = '89', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 14:29:48' WHERE id = '506';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '101.1', '101.1', '2026-10-20', '1', '0', '0', '2026-10-20 14:30:23','اضافة فاتورة مبيعات رقم 357 - صرف البضاعة من المخزن','1','0',null,'0','357','sellbillController.php?do=showDetail&sellbillid=357'); -- id=1824
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1824', '402', '101.1', '','0'); -- id=1840
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1374210.7', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1824', '382', '101.1', '','0'); -- id=1828
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194475.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='1822,1823,1824' where sellbillid=357;
 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-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117, sellCostBuyPrice =sellCostBuyPrice+101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-10-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117, sellCostBuyPrice =sellCostBuyPrice+101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1, 101.1, 103.7)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+117, netSellCostBuyPrice = netSellCostBuyPrice+101.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+101.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+103.7
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+101.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+103.7
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+101.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+101.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+103.7;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad7547d957a3 and sellbillId = 357 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:00:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:30:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:30:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:00:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:30:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:30:37', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:00:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:30:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:30:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:00:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:30:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:30:56', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=357'); -- id=4714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:31:03', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4715
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 357;
UPDATE sellbill SET  sellbillsysdate = '2026-10-20 14:31:04', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '357';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2844;
 INSERT INTO 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-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '225', userid = '1', storedetaildate = '2026-10-20 14:31:04' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '0', '357', 'تعديل فاتورة مبيعات', 'sellbillController.php', '223', '225', '1', '2026-10-20 14:30:21','0','0'); -- id=5032
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 2845;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8, sellCostBuyPrice =sellCostBuyPrice-5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8, sellCostBuyPrice =sellCostBuyPrice-5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-20 14:31:04' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '0', '357', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '29', '1', '2026-10-20 14:30:21','0','0'); -- id=5033
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2846;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.2,0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-16.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-0.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-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-16.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5.65', userid = '1', storedetaildate = '2026-10-20 14:31:04' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.2', '0', '357', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5.45', '5.65', '1', '2026-10-20 14:30:21','0','0'); -- id=5034
CALL clientInUse(73,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '73';
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 ('73','89.00','89.00','1','تعديل فاتورة مبيعات','357', '0', '2026-10-20 14:30:21', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '117', '0', null, '0', null, null,'', '0','1','1','89','1','2026-10-20 14:30:21','0','0','',''); -- id=608
UPDATE client SET  inUse = 0 where clientid = 73;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-844855.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 ('-844827.75','28', '1', '1', 'تعديل فاتورة مبيعات', '357', '-844855.75', '2026-10-20 14:31:05', '1',  'sellbillController.php','73','','0'); -- id=376
 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-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-117, sellCostBuyPrice =sellCostBuyPrice-101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-103.7
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-10-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-117, sellCostBuyPrice =sellCostBuyPrice-101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-103.7
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1, 101.1, 103.7)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-117, netSellCostBuyPrice = netSellCostBuyPrice-101.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-101.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-103.7
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-101.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-103.7
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-101.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-101.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-103.7;

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


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

COMMIT;
BEGIN;
CALL clientInUse(73,@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-20 14:30:21', '06ad7547d957a3', '73', '0.00', '117', '0', '1', '117', '117', '0', '117', '1', '2026-10-20 14:30:21', '', '1', '0', 'الحاج/مصطفي الجبالي', '1', '1', '3', '0', 'الحاج/مصطفي الجبالي', '3.2', '357', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=358
UPDATE client SET  clientdebt = '117', userid = '1' WHERE clientid = '73';
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 ('73','0.00','117','0','اضافة فاتورة مبيعات (معدله)','358', '117', '2026-10-20 14:31:05', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '117', '0', null, '0', null, null,'', '0','1','1','89','1','2026-10-20 14:30:21','0','0','',''); -- id=609
UPDATE client SET  inUse = 0 where clientid = 73;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '358', '12', '83', '2.00', '45', '90', '0', '', '1', '2026-10-20 14:31:06', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-2,','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=2847
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 = 2847;
 INSERT INTO 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-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-10-20 14:31:06' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '358', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '225', '223', '1', '2026-10-20 14:31:06','0','0'); -- id=5035
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.5','00419', '358', '6', '419', '1.00', '8', '8', '0', '', '1', '2026-10-20 14:31:06', '419', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','8','0','','0','0.00','0','0','0','0'); -- id=2848
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 2848;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-20 14:31:06' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '1', '358', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '29', '28', '1', '2026-10-20 14:31:06','0','0'); -- id=5036
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '358', '14', '80', '0.20', '95', '19', '0', '', '1', '2026-10-20 14:31:06', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','19','0','','0','0.00','0','0','0','0'); -- id=2849
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2849;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.2, 0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.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-20', 19, 16.4, 16.4
                    , 16.4, 16.4, 16.4, 16.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16.4, 16.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+16.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5.45', userid = '1', storedetaildate = '2026-10-20 14:31:07' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.2', '1', '358', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5.65', '5.45', '1', '2026-10-20 14:31:07','0','0'); -- id=5037
UPDATE dailyentry SET totalcreditor = '117.00', totaldebtor = '117.00', thedate = '2026-10-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-20 14:30:23', entryComment = 'اضافة فاتورة مبيعات رقم 357', fromFlag = '1',related='0',isopeningentry='0',operationId='357',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=357' WHERE id = '1822';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '117.00', '117.00', '2026-10-20', '1', '0', '1822', '2026-10-20 14:31:07','تم عكس القيد رقم 1822 ','1','0','0','0','0',''); -- id=1825
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1825', '506', '117.00', '','0'); -- id=1829
UPDATE accountstree SET name = 'الحاج/مصطفي الجبالي', customName = 'الحاج/مصطفي الجبالي', customNameEn = 'الحاج/مصطفي الجبالي', nameEn = 'الحاج/مصطفي الجبالي', parent = '58', accountNature = '0', theValue = '-28', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 14:29:48' WHERE id = '506';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1825', '143', '117.00', '','0'); -- id=1841
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1539360.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '28.00', totaldebtor = '28.00', thedate = '2026-10-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-20 14:30:23', entryComment = 'اضافة فاتورة مبيعات رقم 357 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='357',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=357' WHERE id = '1823';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '28.00', '28.00', '2026-10-20', '1', '0', '1823', '2026-10-20 14:31:07','تم عكس القيد رقم 1823 ','1','0','0','0','0',''); -- id=1826
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1826', '383', '28.00', '','0'); -- id=1830
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '207094.54', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1826', '506', '28.00', '','0'); -- id=1842
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-20 14:29:48' WHERE id = '506';
UPDATE dailyentry SET totalcreditor = '101.10', totaldebtor = '101.10', thedate = '2026-10-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-20 14:30:23', entryComment = 'اضافة فاتورة مبيعات رقم 357 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='357',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=357' WHERE id = '1824';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '101.10', '101.10', '2026-10-20', '1', '0', '1824', '2026-10-20 14:31:08','تم عكس القيد رقم 1824 ','1','0','0','0','0',''); -- id=1827
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1827', '402', '101.10', '','0'); -- id=1831
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1374109.6', 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 ('1827', '382', '101.10', '','0'); -- id=1843
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194576.4', 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 ( '117', '117', '2026-10-20', '1', '0', '0', '2026-10-20 14:31:08','اضافة فاتورة مبيعات رقم 358','1','0',null,'0','358','sellbillController.php?do=showDetail&sellbillid=358'); -- id=1828
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1828', '506', '117', '','0'); -- id=1844
UPDATE accountstree SET name = 'الحاج/مصطفي الجبالي', customName = 'الحاج/مصطفي الجبالي', customNameEn = 'الحاج/مصطفي الجبالي', nameEn = 'الحاج/مصطفي الجبالي', parent = '58', accountNature = '0', theValue = '117', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 14:29:48' WHERE id = '506';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1828', '143', '117', '','0'); -- id=1832
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1539477.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '101.1', '101.1', '2026-10-20', '1', '0', '0', '2026-10-20 14:31:08','اضافة فاتورة مبيعات رقم 358 - صرف البضاعة من المخزن','1','0',null,'0','358','sellbillController.php?do=showDetail&sellbillid=358'); -- id=1829
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1829', '402', '101.1', '','0'); -- id=1845
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1374210.7', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1829', '382', '101.1', '','0'); -- id=1833
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194475.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='1828,0,1829' where sellbillid=358;
 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-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117, sellCostBuyPrice =sellCostBuyPrice+101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-10-20', 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,101.1, 103.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117, sellCostBuyPrice =sellCostBuyPrice+101.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+101.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+101.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+101.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+101.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 117, 101.1, 101.1
                    , 103.7, 101.1, 103.7, 101.1, 101.1, 103.7)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+117, netSellCostBuyPrice = netSellCostBuyPrice+101.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+101.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+103.7
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+101.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+103.7
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+101.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+101.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+103.7;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 357 and newid=358 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 14:31:10', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=358'); -- id=4716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:18', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=4717
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:19', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4718
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:24', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:27', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4720
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:35', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-20 14:31:44', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:01:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:31:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 14:31:51', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:19:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:49:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 14:49:03', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4724

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =610
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(54,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '600' , clientdate = '2026-10-20 14:49:04', userid = '1' WHERE clientid = '54';
UPDATE client SET  inUse = 0 where clientid = 54;
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 ('54','1600.00','1000','1','ايصال تحصيل (( قبض من عميل ))','610', '600', '2026-10-20 14:31:52', '1', 'clientPayedDeptController.php', '   ', '1000', '0', null, '0', null, null,'', '-1','1','1','1000','1','','64','0','','.'); -- id=610
UPDATE save SET  savecurrentvalue = '-843855.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-844855.75','1000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '610', '-843855.75', '2026-10-20 14:49:04', '1',  'clientPayedDeptController.php','54','','0'); -- id=377
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1000', '1000', '2026-10-20', '1', '0', '0', '2026-10-20 14:49:04','اضافة ايصال سداد للعميل اخت محمد مديح الشاذلي ','1','0','0','0','610','clientPayedDeptController.php?do=show&id=610'); -- id=1830
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1830', '383', '1000', '','0'); -- id=1846
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '208094.54', 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 ('1830', '487', '1000', '','0'); -- id=1834
UPDATE accountstree SET name = 'اخت محمد مديح الشاذلي ', customName = 'اخت محمد مديح الشاذلي ', customNameEn = 'اخت محمد مديح الشاذلي ', nameEn = 'اخت محمد مديح الشاذلي ', parent = '58', accountNature = '0', theValue = '600', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 20:28:54' WHERE id = '487';
UPDATE clientdebtchange SET clientid = '54', clientdebtchangebefore = '1600.000', clientdebtchangeamount = '1000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '610', clientdebtchangeafter = '600.000', clientdebtchangedate = '2026-10-20 14:31:52', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '1000.000',discount='', reciptid='0', dailyentryid = '1830',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '610';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:19:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:49:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 14:49:05', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4725
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 11:19:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 14:49:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-20 14:49:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:16:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 15:46:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 15:46:28', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4727
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-20 15:46:51', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=74
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('74', '0', '0', '', ''); -- id=74
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 ('74','0','0','0','إضافة عميل جديد','74', '0', '2026-10-20 15:46:51', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=611
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-20 15:46:52'); -- id=507
UPDATE client SET clientname = 'مصطفي نشات ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='507',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 = '74';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:31:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:01:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:01:10', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:31:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:01:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:01:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4729
UPDATE product SET productName = 'لمبه 3 وات ورم الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '7.00', productSellAllPrice = '9.00', productSellUnitPrice = '9.00', productSellHalfPrice = '9.00', productDate = '2026-10-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00600',type ='0', expireDate = '0' , dailyentryId = '1689',isService = '0',isOptic = '0',lastbuyprice = '7.00',lastbuyprice_withDiscount = '7',meanbuyprice = '7.00',meanbuyprice_withDiscount = '7' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '28.57' , buyhalf_precentage = '28.57' , buypart_precentage = '28.57',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7',meanbuyprice_withTax='7',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '600';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (600, 1,'2026-10-20 16:01:59',1)
                ON DUPLICATE KEY UPDATE productid = 600, edited = 1, sysdate = '2026-10-20 16:01:59', userid = 1; -- id=802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:32:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:02:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:02:02', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:32:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:02:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:02:08', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:33:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:03:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:03:37', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4732
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لمبه 3 وات ابيض الفرسان ','','6','8','10','10','10','2026-10-20','0','1','0','','0','0','0','0','0','8','8','8','8','8','0','25','25','25','.','0','0','0','8','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','8','8','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','8','0','0','0','0','0','0','','','0','0','0','0'); -- id=612
UPDATE product SET productName = 'لمبه 3 وات ابيض الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '8', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00612',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '612';
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', '612', '1.00', '2026-10-20', '1', '0','0061201','10','10','10','8','','0','0','0','0','0','0','0','0','0','0'); -- id=612
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('612', '1', '20', '1', '2026-10-20'); -- id=612
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '1', '20', '0', '612', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-10-20','0','0'); -- id=5038
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (612, 1,'2026-10-20 16:03:39',1)
                ON DUPLICATE KEY UPDATE productid = 612, edited = 1, sysdate = '2026-10-20 16:03:39', userid = 1; -- id=825
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '160', '160', '2026-10-20', '1', '0', '0', '2026-10-20 16:03:39','إضافة منتج لمبه 3 وات ابيض الفرسان  الكمية 20','1','0','0','0','612','productController.php?do=edit&id=612'); -- id=1831
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1831', '382', '160', '','0'); -- id=1847
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194635.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1831', '121', '160', '','0'); -- id=1835
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1871505.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه 3 وات ابيض الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '8.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00612',type ='0', expireDate = '0' , dailyentryId = '1831',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '612';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لمبه بلحه ورم الفرسان','','6','8','10','10','10','2026-10-20','0','1','0','','0','0','0','0','0','8','8','8','8','8','0','25','25','25','.','0','0','0','8','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','8','8','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','8','0','0','0','0','0','0','','','0','0','0','0'); -- id=613
UPDATE product SET productName = 'لمبه بلحه ورم الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '8', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '613';
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', '613', '1.00', '2026-10-20', '1', '0','0061301','10','10','10','8','','0','0','0','0','0','0','0','0','0','0'); -- id=613
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('613', '1', '6', '1', '2026-10-20'); -- id=613
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '1', '6', '0', '613', 'إضافة منتج', 'productController.php', '0', '6', '1', '2026-10-20','0','0'); -- id=5039
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (613, 1,'2026-10-20 16:03:41',1)
                ON DUPLICATE KEY UPDATE productid = 613, edited = 1, sysdate = '2026-10-20 16:03:41', userid = 1; -- id=826
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '48', '48', '2026-10-20', '1', '0', '0', '2026-10-20 16:03:41','إضافة منتج لمبه بلحه ورم الفرسان الكمية 6','1','0','0','0','613','productController.php?do=edit&id=613'); -- id=1832
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1832', '382', '48', '','0'); -- id=1848
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194683.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1832', '121', '48', '','0'); -- id=1836
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1871553.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه بلحه ورم الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '8.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '1832',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '613';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لمبه بلحه ابيض الفرسان','','6','8','10','10','10','2026-10-20','0','1','0','','0','0','0','0','0','8','8','8','8','8','0','25','25','25','.','0','0','0','8','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','8','8','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','8','0','0','0','0','0','0','','','0','0','0','0'); -- id=614
UPDATE product SET productName = 'لمبه بلحه ابيض الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '8', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '614';
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', '614', '1.00', '2026-10-20', '1', '0','0061401','10','10','10','8','','0','0','0','0','0','0','0','0','0','0'); -- id=614
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('614', '1', '2', '1', '2026-10-20'); -- id=614
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '1', '2', '0', '614', 'إضافة منتج', 'productController.php', '0', '2', '1', '2026-10-20','0','0'); -- id=5040
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (614, 1,'2026-10-20 16:03:43',1)
                ON DUPLICATE KEY UPDATE productid = 614, edited = 1, sysdate = '2026-10-20 16:03:43', userid = 1; -- id=827
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16', '16', '2026-10-20', '1', '0', '0', '2026-10-20 16:03:43','إضافة منتج لمبه بلحه ابيض الفرسان الكمية 2','1','0','0','0','614','productController.php?do=edit&id=614'); -- id=1833
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1833', '382', '16', '','0'); -- id=1849
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194699.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1833', '121', '16', '','0'); -- id=1837
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1871569.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه بلحه ابيض الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '8.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '1833',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '614';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 12:33:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 16:03:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 16:03:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:47:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:17:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:17:16', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:47:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:17:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:17:32', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:47:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:17:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:17:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:48:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:18:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:18:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:51:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:21:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:21:02', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4738

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad770bab544b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(74,@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-20 18:21:02', '06ad770bab544b', '74', '0.00', '3357.75', '0', '1', '3357.75', '3357.75', '0', '3357.75', '1', '2026-10-20 18:21:02', '', '1', '0', 'مصطفي نشات ', '1', '1', '3', '0', 'مصطفي نشات ', '101' ,'0','','','','','-1','0','0','0','0','0','3357','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=359
UPDATE client SET  clientdebt = '3357.75', userid = '1' WHERE clientid = '74';
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 ('74','0.00','3357.75','0','اضافة فاتورة مبيعات','359', '3357.75', '2026-10-20 18:21:03', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3357.75', '0', null, '0', null, null,'', '0','1','1','3357.75','1','2026-10-20 18:21:02','0','0','',''); -- id=612
UPDATE client SET  inUse = 0 where clientid = 74;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 91;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14','00206', '359', '6', '206', '80', '20', '1600', '0', '', '1', '2026-10-20 18:21:03', '206', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','91-7,','1','1','0','0','20','1600','0','','0','0.00','0','0','0','0'); -- id=2850
UPDATE sellbilldetail SET  lastbuyprice = 14.00 , meanbuyprice = 14.00, lastbuyprice_withDiscount = 14.00, meanbuyprice_withDiscount = 14.00
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where sellbilldetailid = 2850;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (206, '2026-10-20', 1600, 1120, 1120
                    , 1120, 1120, 1120, 1120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 1120, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 1600, 1120, 1120
                    , 1120, 1120, 1120, 1120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1120, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1600, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-20 18:21:04' WHERE storedetailid = '206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('206', '1', '80', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '85', '5', '1', '2026-10-20 18:21:04','0','0'); -- id=5041
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '359', '6', '207', '5', '15', '75', '0', '', '1', '2026-10-20 18:21:04', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','75','0','','0','0.00','0','0','0','0'); -- id=2851
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2851;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-20', 75, 55, 55
                    , 55, 55, 55, 55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 55, 55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 75, 55, 55
                    , 55, 55, 55, 55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55, 55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-20 18:21:04' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '5', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '45', '1', '2026-10-20 18:21:04','0','0'); -- id=5042
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '359', '14', '81', '2', '19', '38', '0', '', '1', '2026-10-20 18:21:04', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2852
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 = 2852;
 INSERT INTO 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-20', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-20 18:21:04' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '48', '1', '2026-10-20 18:21:04','0','0'); -- id=5043
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 95;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '359', '19', '175', '4', '330', '1320', '0', '', '1', '2026-10-20 18:21:04', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','95-4,','1','1','0','0','330','1320','0','','0','0.00','0','0','0','0'); -- id=2853
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2853;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-20', 1320, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 1320, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-20 18:21:05' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '48', '1', '2026-10-20 18:21:05','0','0'); -- id=5044
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', '359', '24', '291', '2', '28', '56', '0', '', '1', '2026-10-20 18:21:05', '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=2854
UPDATE sellbilldetail SET  lastbuyprice = 25.60 , meanbuyprice = 25.32, lastbuyprice_withDiscount = 25.60, meanbuyprice_withDiscount = 25.32
        , lastbuyprice_withTax = 25.6, meanbuyprice_withTax = 25.32, lastbuyprice_withDiscountAndTax = 25.6
                where sellbilldetailid = 2854;
 INSERT INTO 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-20', 56, 51.2, 51.2
                    , 50.64, 51.2, 50.64, 50.48
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 51.2, 50.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.48
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 56, 51.2, 51.2
                    , 50.64, 51.2, 50.64, 50.48
                    , 0, 0, 0, 0
                    , 0, 0, 0, 51.2, 50.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.48
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '140', userid = '1', storedetaildate = '2026-10-20 18:21:05' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '2', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '142', '140', '1', '2026-10-20 18:21:05','0','0'); -- id=5045
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.7','00301', '359', '4', '301', '1', '52.65', '52.65', '0', '', '1', '2026-10-20 18:21:05', '301', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','52.65','52.65','0','','0','0.00','0','0','0','0'); -- id=2855
UPDATE sellbilldetail SET  lastbuyprice = 50.70 , meanbuyprice = 50.70, lastbuyprice_withDiscount = 50.70, meanbuyprice_withDiscount = 50.70
        , lastbuyprice_withTax = 50.7, meanbuyprice_withTax = 50.7, lastbuyprice_withDiscountAndTax = 50.7
                where sellbilldetailid = 2855;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (301, '2026-10-20', 52.65, 50.7, 50.7
                    , 50.7, 50.7, 50.7, 50.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 50.7, 50.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+52.65, sellCostBuyPrice =sellCostBuyPrice+50.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+50.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+50.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+50.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 52.65, 50.7, 50.7
                    , 50.7, 50.7, 50.7, 50.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50.7, 50.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+52.65, sellCostBuyPrice =sellCostBuyPrice+50.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+50.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+50.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+50.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+50.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+50.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+50.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+50.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-10-20 18:21:05' WHERE storedetailid = '301';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('301', '1', '1', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '43', '1', '2026-10-20 18:21:05','0','0'); -- id=5046
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13.8','00280', '359', '4', '280', '2', '14.3', '28.6', '0', '', '1', '2026-10-20 18:21:05', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.3','28.6','0','','0','0.00','0','0','0','0'); -- id=2856
UPDATE sellbilldetail SET  lastbuyprice = 13.80 , meanbuyprice = 13.80, lastbuyprice_withDiscount = 13.80, meanbuyprice_withDiscount = 13.80
        , lastbuyprice_withTax = 13.8, meanbuyprice_withTax = 13.8, lastbuyprice_withDiscountAndTax = 13.8
                where sellbilldetailid = 2856;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (280, '2026-10-20', 28.6, 27.6, 27.6
                    , 27.6, 27.6, 27.6, 27.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 27.6, 27.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28.6, sellCostBuyPrice =sellCostBuyPrice+27.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27.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-20', 28.6, 27.6, 27.6
                    , 27.6, 27.6, 27.6, 27.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27.6, 27.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28.6, sellCostBuyPrice =sellCostBuyPrice+27.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27.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 = '118', userid = '1', storedetaildate = '2026-10-20 18:21:06' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '2', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '118', '1', '2026-10-20 18:21:06','0','0'); -- id=5047
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 204;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('7','00368', '359', '4', '368', '1', '7.5', '7.5', '0', '', '1', '2026-10-20 18:21:06', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','204-1,','1','1','0','0','7.5','7.5','0','','0','0.00','0','0','0','0'); -- id=2857
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2857;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-20', 7.5, 7, 7
                    , 7, 7, 7, 7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 7, 7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7.5, sellCostBuyPrice =sellCostBuyPrice+7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 7.5, 7, 7
                    , 7, 7, 7, 7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7.5, sellCostBuyPrice =sellCostBuyPrice+7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '316', userid = '1', storedetaildate = '2026-10-20 18:21:06' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '1', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '317', '316', '1', '2026-10-20 18:21:06','0','0'); -- id=5048
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00372', '359', '4', '372', '1', '12', '12', '0', '', '1', '2026-10-20 18:21:06', '372', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=2858
UPDATE sellbilldetail SET  lastbuyprice = 10.50 , meanbuyprice = 10.50, lastbuyprice_withDiscount = 10.50, meanbuyprice_withDiscount = 10.50
        , lastbuyprice_withTax = 10.5, meanbuyprice_withTax = 10.5, lastbuyprice_withDiscountAndTax = 10.5
                where sellbilldetailid = 2858;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (372, '2026-10-20', 12, 10.5, 10.5
                    , 10.5, 10.5, 10.5, 10.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.5, 10.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 12, 10.5, 10.5
                    , 10.5, 10.5, 10.5, 10.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.5, 10.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '109', userid = '1', storedetaildate = '2026-10-20 18:21:06' WHERE storedetailid = '372';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('372', '1', '1', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '110', '109', '1', '2026-10-20 18:21:06','0','0'); -- id=5049
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00160', '359', '22', '160', '1', '140', '140', '0', '', '1', '2026-10-20 18:21:06', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','73-1,','1','1','0','0','140','140','0','','0','0.00','0','0','0','0'); -- id=2859
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 2859;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-20', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2026-10-20 18:21:07' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '1', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '89', '88', '1', '2026-10-20 18:21:07','0','0'); -- id=5050
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('12','00430', '359', '10', '430', '2', '14', '28', '0', '', '1', '2026-10-20 18:21:07', '430', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14','28','0','','0','0.00','0','0','0','0'); -- id=2860
UPDATE sellbilldetail SET  lastbuyprice = 12.00 , meanbuyprice = 12.00, lastbuyprice_withDiscount = 12.00, meanbuyprice_withDiscount = 12.00
        , lastbuyprice_withTax = 12, meanbuyprice_withTax = 12, lastbuyprice_withDiscountAndTax = 12
                where sellbilldetailid = 2860;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (430, '2026-10-20', 28, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 28, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-20 18:21:07' WHERE storedetailid = '430';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('430', '1', '2', '1', '359', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '8', '1', '2026-10-20 18:21:07','0','0'); -- id=5051
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3357.75', '3357.75', '2026-10-20', '1', '0', '0', '2026-10-20 18:21:07','اضافة فاتورة مبيعات رقم 359','1','0',null,'0','359','sellbillController.php?do=showDetail&sellbillid=359'); -- id=1834
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1834', '507', '3357.75', '','0'); -- id=1850
UPDATE accountstree SET name = 'مصطفي نشات ', customName = 'مصطفي نشات ', customNameEn = 'مصطفي نشات ', nameEn = 'مصطفي نشات ', parent = '58', accountNature = '0', theValue = '3357.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 15:46:52' WHERE id = '507';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1834', '143', '3357.75', '','0'); -- id=1838
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1542835.65', 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 ( '2802', '2802', '2026-10-20', '1', '0', '0', '2026-10-20 18:21:07','اضافة فاتورة مبيعات رقم 359 - صرف البضاعة من المخزن','1','0',null,'0','359','sellbillController.php?do=showDetail&sellbillid=359'); -- id=1835
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1835', '402', '2802', '','0'); -- id=1851
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1377012.7', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1835', '382', '2802', '','0'); -- id=1839
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2191897.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='1834,0,1835' where sellbillid=359;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-20', 3357.75, 2802, 2802
                    , 2801.44, 2802, 2801.44, 2801.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2802, 2801.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3357.75, sellCostBuyPrice =sellCostBuyPrice+2802
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2802, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2801.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2802, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2801.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2801.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2802
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2801.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (74, '2026-10-20', 3357.75, 2802, 2802
                    , 2801.44, 2802, 2801.44, 2801.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2802, 2801.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3357.75, sellCostBuyPrice =sellCostBuyPrice+2802
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2802, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2801.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2802, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2801.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2801.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2802
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2801.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3357.75, 2802, 2802
                    , 2801.44, 2802, 2801.44, 2801.28, 2802, 2801.44)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3357.75, netSellCostBuyPrice = netSellCostBuyPrice+2802
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2802
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2801.44
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2802
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2801.44
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2801.28
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2802
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2801.44;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad770bab544b and sellbillId = 359 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 14:51:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:21:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:21:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4739
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:15:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:45:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-20 18:45:52', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=4740
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:16:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:46:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-20 18:46:01', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=4741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:17:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:47:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-20 18:47:59', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:18:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:48:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-20 18:48:06', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4743
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:18:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:48:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 18:48:13', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=65'); -- id=4744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:18:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 18:48:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-20 18:48:34', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:37:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:07:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-20 19:07:50', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4746
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:37:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:07:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 19:07:54', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=4747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:39:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:09:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 19:09:22', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4748
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('06ad79fec068de', '2026-10-20 19:07:56', '8', '9600.00', '2712.5', '0', '0', '-6887.50', '-6887.50', '0', '-6887.5', '1', '2026-10-20 19:09:23', '', '1', '0', '', '1', '6','1','0.00','-1','0','1','0','0','0','0','0'); -- id=1
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00549', '1', '2', '549', '390', '17.5', '6825', '0', '', '549','','','0','0','0','0','0','17.5','6825','0','0','0','0','0','0','0','1'); -- id=1
UPDATE product SET productName = 'لمبه كاسه 3 تكه كينو', productDescription = '', productCatId = '2', productBuyPrice = '17.50', productSellAllPrice = '24.00', productSellUnitPrice = '28.00', productSellHalfPrice = '24.00', productDate = '2026-09-30', conditions = '0', userId = '1', limitamount = '1', parcode = '00549',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '17.5',lastbuyprice_withDiscount = '17.5',meanbuyprice = '17.50',meanbuyprice_withDiscount = '17.5' , productbuypricereal = '17.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='17.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='17.5',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='17.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 = '549';
UPDATE returnbuybilldetail SET  lastbuyprice = 17.5 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.5, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where returnbuybilldetailid = 1;
UPDATE productunit SET proUnitBuyPrice  = 17.5 * productnumber WHERE productid = 549;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('549', '1', '390', '1', '1', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '390', '0', '1', '2026-10-20 19:07:56','0','0'); -- id=5052
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00172', '1', '2', '172', '1', '7', '7', '0', '', '172','','','0','0','0','0','0','7','7','0','0','0','0','0','0','0','1'); -- id=2
UPDATE product SET productName = 'لمبه 5 وات ايجي ابيض', productDescription = '', productCatId = '2', productBuyPrice = '7.00', productSellAllPrice = '9.00', productSellUnitPrice = '10.00', productSellHalfPrice = '9.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00172',type ='0', expireDate = '0' , dailyentryId = '196',isService = '0',isOptic = '0',lastbuyprice = '7',lastbuyprice_withDiscount = '7',meanbuyprice = '7',meanbuyprice_withDiscount = '7' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '28.57' , buyhalf_precentage = '28.57' , buypart_precentage = '42.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7',meanbuyprice_withTax='7',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '172';
UPDATE returnbuybilldetail SET  lastbuyprice = 7 , meanbuyprice = 7, lastbuyprice_withDiscount = 7, meanbuyprice_withDiscount = 7
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where returnbuybilldetailid = 2;
UPDATE productunit SET proUnitBuyPrice  = 7 * productnumber WHERE productid = 172;
UPDATE storedetail SET  productquantity = '66', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '172';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('172', '1', '1', '1', '1', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '67', '66', '1', '2026-10-20 19:07:56','0','0'); -- id=5053
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00168', '1', '2', '168', '1', '21.5', '21.5', '0', '', '168','','','0','0','0','0','0','21.5','21.5','0','0','0','0','0','0','0','1'); -- id=3
UPDATE product SET productName = 'لمبه 13 وات كينو قلاوظ ', productDescription = '', productCatId = '2', productBuyPrice = '21.50', productSellAllPrice = '24.50', productSellUnitPrice = '30.00', productSellHalfPrice = '25.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00168',type ='0', expireDate = '0' , dailyentryId = '192',isService = '0',isOptic = '0',lastbuyprice = '21.5',lastbuyprice_withDiscount = '21.5',meanbuyprice = '21.5',meanbuyprice_withDiscount = '21.5' , productbuypricereal = '21.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '13.95' , buyhalf_precentage = '16.28' , buypart_precentage = '39.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21.5',meanbuyprice_withTax='21.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21.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 = '168';
UPDATE returnbuybilldetail SET  lastbuyprice = 21.5 , meanbuyprice = 21.5, lastbuyprice_withDiscount = 21.5, meanbuyprice_withDiscount = 21.5
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where returnbuybilldetailid = 3;
UPDATE productunit SET proUnitBuyPrice  = 21.5 * productnumber WHERE productid = 168;
UPDATE storedetail SET  productquantity = '172', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '1', '1', '1', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '173', '172', '1', '2026-10-20 19:07:56','0','0'); -- id=5054
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00169', '1', '2', '169', '1', '34', '34', '0', '', '169','','','0','0','0','0','0','34','34','0','0','0','0','0','0','0','1'); -- id=4
UPDATE product SET productName = 'لمبه 20 وات كينو قلاوظ', productDescription = '', productCatId = '2', productBuyPrice = '34.00', productSellAllPrice = '38.50', productSellUnitPrice = '50.00', productSellHalfPrice = '42.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00169',type ='0', expireDate = '0' , dailyentryId = '193',isService = '0',isOptic = '0',lastbuyprice = '34',lastbuyprice_withDiscount = '34',meanbuyprice = '34',meanbuyprice_withDiscount = '34' , productbuypricereal = '34.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '13.24' , buyhalf_precentage = '23.53' , buypart_precentage = '47.06',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='34',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='34',meanbuyprice_withTax='34',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='34',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '169';
UPDATE returnbuybilldetail SET  lastbuyprice = 34 , meanbuyprice = 34, lastbuyprice_withDiscount = 34, meanbuyprice_withDiscount = 34
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where returnbuybilldetailid = 4;
UPDATE productunit SET proUnitBuyPrice  = 34 * productnumber WHERE productid = 169;
UPDATE storedetail SET  productquantity = '177', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '1', '1', '1', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '178', '177', '1', '2026-10-20 19:07:56','0','0'); -- id=5055
UPDATE supplier SET  suppliercurrentDebt = '2712.5',suppliercurrentDebtInCurrency= '2712.5' , userid = '1', supplierdate = '2026-10-20 19:09:23'   WHERE supplierid = '8';
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 ('8', '9600.00', '6887.5', '1', 'اضافة فاتورة مردوات مشتريات', '1', '2712.5', '2026-10-20 19:07:56', '1', 'returnBuyBillController.php', 'اضافة فاتورة مردوات مشتريات', '0','', '0','1','1','6887.5','1','9600','6887.5','2712.5','0',''); -- id=109
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6887.5', '6887.5', '2026-10-20', '1', '0', '0', '2026-10-20 19:09:26','اضافة فاتورة مردود مشتريات رقم 1','1','0',null,'0','1','returnBuyBillController.php?do=details&id=1'); -- id=1836
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1836', '429', '6887.5', '','0'); -- id=1852
UPDATE accountstree SET name = 'محمد الفرسان ', customName = 'محمد الفرسان ', customNameEn = 'محمد الفرسان ', nameEn = 'محمد الفرسان ', parent = '81', accountNature = '1', theValue = '2712.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 10:36:58' WHERE id = '429';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1836', '382', '6887.5', '','0'); -- id=1840
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2185009.8', 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 returnbuybill set dailyentryid='1836,0' where returnbuybillid=1;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:39:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:09:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-20 19:09:27', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnBuyBillController.php?do=editprint&id=1'); -- id=4749
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:39:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:09:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 19:09:38', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4750
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:40:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:10:40', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:41:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:11:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:11:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4752
UPDATE product SET productName = 'لمبه 5 وات ورم الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '7.00', productSellAllPrice = '9.00', productSellUnitPrice = '9.00', productSellHalfPrice = '9.00', productDate = '2026-10-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00600',type ='0', expireDate = '0' , dailyentryId = '1689',isService = '0',isOptic = '0',lastbuyprice = '7.00',lastbuyprice_withDiscount = '7',meanbuyprice = '7.00',meanbuyprice_withDiscount = '7' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '28.57' , buyhalf_precentage = '28.57' , buypart_precentage = '28.57',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7',meanbuyprice_withTax='7',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '600';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (600, 1,'2026-10-20 19:11:13',1)
                ON DUPLICATE KEY UPDATE productid = 600, edited = 1, sysdate = '2026-10-20 19:11:13', userid = 1; -- id=802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:42:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:12:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:12:17', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:42:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:12:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:12:25', '1', 'executeOperation', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=executeOperation'); -- id=4754
BEGIN;
UPDATE dailyentry SET totalcreditor = '160.00', totaldebtor = '160.00', thedate = '2026-10-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-20 16:03:39', entryComment = 'إضافة منتج لمبه 3 وات ابيض الفرسان  الكمية 20', fromFlag = '1',related='0',isopeningentry='0',operationId='612',operationDetailLink='productController.php?do=edit&id=612' WHERE id = '1831';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '160.00', '160.00', '2026-10-20', '1', '0', '1831', '2026-10-20 19:12:25','تم عكس القيد رقم 1831 ','1','0','0','0','0',''); -- id=1837
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1837', '382', '160.00', '','0'); -- id=1841
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2184849.8', 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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1837', '121', '160.00', '','0'); -- id=1853
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1871409.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه 3 وات ابيض الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '8.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '2', userId = '1', limitamount = '0', parcode = '00612',type ='0', expireDate = '0' , dailyentryId = '1837',isService = '0',isOptic = '0',lastbuyprice = '8.00',lastbuyprice_withDiscount = '8',meanbuyprice = '8.00',meanbuyprice_withDiscount = '8' , productbuypricereal = '8.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '25.00' , buyhalf_precentage = '25.00' , buypart_precentage = '25.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '612';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (612, 2,'2026-10-20 19:12:26',1)
                ON DUPLICATE KEY UPDATE productid = 612, edited = 2, sysdate = '2026-10-20 19:12:26', userid = 1; -- id=825
DELETE FROM productingredients WHERE productId = '612';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:42:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:12:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:12:27', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=sucess'); -- id=4755
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:42:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:12:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-20 19:12:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4756
UPDATE productunit SET unitid = '1', productid = '613', productnumber = '1.00', productunitdate = '2026-10-20', userid = '1', conditions = '0',proUnitParcode='0061301',proUnitSellAllPrice='10',proUnitSellHalfPrice='10',proUnitSellUnitPrice ='10',proUnitBuyPrice='8',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '613';
UPDATE product SET productName = 'لمبه بلحه ورم الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '7', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '1832',isService = '0',isOptic = '0',lastbuyprice = '8.00',lastbuyprice_withDiscount = '8',meanbuyprice = '8.00',meanbuyprice_withDiscount = '8' , productbuypricereal = '7' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '613';
UPDATE productunit SET unitid = '1', productid = '614', productnumber = '1.00', productunitdate = '2026-10-20', userid = '1', conditions = '0',proUnitParcode='0061401',proUnitSellAllPrice='10',proUnitSellHalfPrice='10',proUnitSellUnitPrice ='10',proUnitBuyPrice='8',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '614';
UPDATE product SET productName = 'لمبه بلحه ابيض الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '7', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '1833',isService = '0',isOptic = '0',lastbuyprice = '8.00',lastbuyprice_withDiscount = '8',meanbuyprice = '8.00',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '614';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:44:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:14:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 19:14:34', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4757
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 ('06ad7a05326bf2', '2026-10-20 19:09:39', '8', '2712.50', '5000.5', '0', '0', '8025.00',  '8025.00', '5737', '2288', '1', '2026-10-20 19:14:35', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=64
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 ('00172', '64', '2', '172', '50', '7', '350.00', '0', '', '2026-10-20 19:14:35', '172','','','0','0','0','0','0',null,'7','350','0','0','0','0','0','0','0','0','1'); -- id=236
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 172, 0, 0
                    , 7, 50, 0, 0, 1, '2026-10-20 19:14:35')
                ON DUPLICATE KEY UPDATE buyprice = 7,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:35' ; -- id=236
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('172', '7', '50', '0', 'buyBillController.php', '236', '', '0', '0'); -- id=236
UPDATE product SET  productBuyPrice = "7" WHERE productId = 172 ;
UPDATE buybilldetail SET  quantitybefore = 66 WHERE buybilldetailid = 236 ;
UPDATE product SET productName = 'لمبه 5 وات ايجي ابيض', productDescription = '', productCatId = '2', productBuyPrice = '7.00', productSellAllPrice = '9.00', productSellUnitPrice = '10.00', productSellHalfPrice = '9.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00172',type ='0', expireDate = '0' , dailyentryId = '196',isService = '0',isOptic = '0',lastbuyprice = '7',lastbuyprice_withDiscount = '7',meanbuyprice = '7',meanbuyprice_withDiscount = '7' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '28.57' , buyhalf_precentage = '28.57' , buypart_precentage = '42.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7',meanbuyprice_withTax='7',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '172';
UPDATE buybilldetail SET  lastbuyprice = 7 , meanbuyprice = 7, lastbuyprice_withDiscount = 7, meanbuyprice_withDiscount = 7
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where buybilldetailid = 236;
UPDATE productunit SET proUnitBuyPrice  = 7 * productnumber WHERE productid = 172;
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '172';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('172', '1', '50', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '66', '116', '1', '2026-10-20 19:09:39','0','0'); -- id=5056
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 ('00600', '64', '6', '600', '50', '7', '350.00', '0', '', '2026-10-20 19:14:35', '600','','','0','0','0','0','0',null,'7','350','0','0','0','0','0','0','0','0','1'); -- id=237
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 600, 0, 0
                    , 7, 50, 0, 0, 1, '2026-10-20 19:14:36')
                ON DUPLICATE KEY UPDATE buyprice = 7,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:36' ; -- id=237
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('600', '7', '50', '0', 'buyBillController.php', '237', '', '0', '0'); -- id=237
UPDATE product SET  productBuyPrice = "7" WHERE productId = 600 ;
UPDATE buybilldetail SET  quantitybefore = 40 WHERE buybilldetailid = 237 ;
UPDATE product SET productName = 'لمبه 5 وات ورم الفرسان ', productDescription = '', productCatId = '6', productBuyPrice = '7.00', productSellAllPrice = '9.00', productSellUnitPrice = '9.00', productSellHalfPrice = '9.00', productDate = '2026-10-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00600',type ='0', expireDate = '0' , dailyentryId = '1689',isService = '0',isOptic = '0',lastbuyprice = '7',lastbuyprice_withDiscount = '7',meanbuyprice = '7',meanbuyprice_withDiscount = '7' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '28.57' , buyhalf_precentage = '28.57' , buypart_precentage = '28.57',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7',meanbuyprice_withTax='7',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '600';
UPDATE buybilldetail SET  lastbuyprice = 7 , meanbuyprice = 7, lastbuyprice_withDiscount = 7, meanbuyprice_withDiscount = 7
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where buybilldetailid = 237;
UPDATE productunit SET proUnitBuyPrice  = 7 * productnumber WHERE productid = 600;
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '600';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('600', '1', '50', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '40', '90', '1', '2026-10-20 19:09:39','0','0'); -- id=5057
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 ('00613', '64', '6', '613', '50', '7', '350.00', '0', '', '2026-10-20 19:14:35', '613','','','0','0','0','0','0',null,'7','350','0','0','0','0','0','0','0','0','1'); -- id=238
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 613, 0, 0
                    , 7, 50, 0, 0, 1, '2026-10-20 19:14:37')
                ON DUPLICATE KEY UPDATE buyprice = 7,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:37' ; -- id=238
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('613', '7', '50', '0', 'buyBillController.php', '238', '', '0', '0'); -- id=238
UPDATE product SET  productBuyPrice = "7" WHERE productId = 613 ;
UPDATE buybilldetail SET  quantitybefore = 6 WHERE buybilldetailid = 238 ;
UPDATE product SET productName = 'لمبه بلحه ورم الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '7.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '1832',isService = '0',isOptic = '0',lastbuyprice = '7',lastbuyprice_withDiscount = '7',meanbuyprice = '7.11',meanbuyprice_withDiscount = '7.11' , productbuypricereal = '7.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '25.00' , buyhalf_precentage = '25.00' , buypart_precentage = '25.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',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='7',meanbuyprice_withTax='7.11',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='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '613';
UPDATE buybilldetail SET  lastbuyprice = 7 , meanbuyprice = 7.11, lastbuyprice_withDiscount = 7, meanbuyprice_withDiscount = 7.11
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7.11, lastbuyprice_withDiscountAndTax = 7
                where buybilldetailid = 238;
UPDATE productunit SET proUnitBuyPrice  = 7 * productnumber WHERE productid = 613;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '613';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '1', '50', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '6', '56', '1', '2026-10-20 19:09:39','0','0'); -- id=5058
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 ('00614', '64', '6', '614', '50', '7', '350.00', '0', '', '2026-10-20 19:14:35', '614','','','0','0','0','0','0',null,'7','350','0','0','0','0','0','0','0','0','1'); -- id=239
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 614, 0, 0
                    , 7, 50, 0, 0, 1, '2026-10-20 19:14:38')
                ON DUPLICATE KEY UPDATE buyprice = 7,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:38' ; -- id=239
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('614', '7', '50', '0', 'buyBillController.php', '239', '', '0', '0'); -- id=239
UPDATE product SET  productBuyPrice = "7" WHERE productId = 614 ;
UPDATE buybilldetail SET  quantitybefore = 2 WHERE buybilldetailid = 239 ;
UPDATE product SET productName = 'لمبه بلحه ابيض الفرسان', productDescription = '', productCatId = '6', productBuyPrice = '7.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-10-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '1833',isService = '0',isOptic = '0',lastbuyprice = '7',lastbuyprice_withDiscount = '7',meanbuyprice = '7.04',meanbuyprice_withDiscount = '7.04' , productbuypricereal = '8.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '25.00' , buyhalf_precentage = '25.00' , buypart_precentage = '25.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',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='7',meanbuyprice_withTax='7.04',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='7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '614';
UPDATE buybilldetail SET  lastbuyprice = 7 , meanbuyprice = 7.04, lastbuyprice_withDiscount = 7, meanbuyprice_withDiscount = 7.04
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7.04, lastbuyprice_withDiscountAndTax = 7
                where buybilldetailid = 239;
UPDATE productunit SET proUnitBuyPrice  = 7 * productnumber WHERE productid = 614;
UPDATE storedetail SET  productquantity = '52', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '614';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '1', '50', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '2', '52', '1', '2026-10-20 19:09:39','0','0'); -- id=5059
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 ('00168', '64', '2', '168', '150', '21.5', '3225.00', '0', '', '2026-10-20 19:14:35', '168','','','0','0','0','0','0',null,'21.5','3225','0','0','0','0','0','0','0','0','1'); -- id=240
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 168, 0, 0
                    , 21.5, 150, 0, 0, 1, '2026-10-20 19:14:39')
                ON DUPLICATE KEY UPDATE buyprice = 21.5,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:39' ; -- id=240
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('168', '21.5', '150', '0', 'buyBillController.php', '240', '', '0', '0'); -- id=240
UPDATE product SET  productBuyPrice = "21.5" WHERE productId = 168 ;
UPDATE buybilldetail SET  quantitybefore = 172 WHERE buybilldetailid = 240 ;
UPDATE product SET productName = 'لمبه 13 وات كينو قلاوظ ', productDescription = '', productCatId = '2', productBuyPrice = '21.50', productSellAllPrice = '24.50', productSellUnitPrice = '30.00', productSellHalfPrice = '25.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00168',type ='0', expireDate = '0' , dailyentryId = '192',isService = '0',isOptic = '0',lastbuyprice = '21.5',lastbuyprice_withDiscount = '21.5',meanbuyprice = '21.5',meanbuyprice_withDiscount = '21.5' , productbuypricereal = '21.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '13.95' , buyhalf_precentage = '16.28' , buypart_precentage = '39.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21.5',meanbuyprice_withTax='21.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21.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 = '168';
UPDATE buybilldetail SET  lastbuyprice = 21.5 , meanbuyprice = 21.5, lastbuyprice_withDiscount = 21.5, meanbuyprice_withDiscount = 21.5
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where buybilldetailid = 240;
UPDATE productunit SET proUnitBuyPrice  = 21.5 * productnumber WHERE productid = 168;
UPDATE storedetail SET  productquantity = '322', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '150', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '172', '322', '1', '2026-10-20 19:09:39','0','0'); -- id=5060
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 ('00169', '64', '2', '169', '100', '34', '3400.00', '0', '', '2026-10-20 19:14:35', '169','','','0','0','0','0','0',null,'34','3400','0','0','0','0','0','0','0','0','1'); -- id=241
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-20 19:09:39', 1, 169, 0, 0
                    , 34, 100, 0, 0, 1, '2026-10-20 19:14:39')
                ON DUPLICATE KEY UPDATE buyprice = 34,
                        buyQuantity =buyQuantity+100, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-20 19:14:39' ; -- id=241
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('169', '34', '100', '0', 'buyBillController.php', '241', '', '0', '0'); -- id=241
UPDATE product SET  productBuyPrice = "34" WHERE productId = 169 ;
UPDATE buybilldetail SET  quantitybefore = 177 WHERE buybilldetailid = 241 ;
UPDATE product SET productName = 'لمبه 20 وات كينو قلاوظ', productDescription = '', productCatId = '2', productBuyPrice = '34.00', productSellAllPrice = '38.50', productSellUnitPrice = '50.00', productSellHalfPrice = '42.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00169',type ='0', expireDate = '0' , dailyentryId = '193',isService = '0',isOptic = '0',lastbuyprice = '34',lastbuyprice_withDiscount = '34',meanbuyprice = '34',meanbuyprice_withDiscount = '34' , productbuypricereal = '34.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '13.24' , buyhalf_precentage = '23.53' , buypart_precentage = '47.06',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='34',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='34',meanbuyprice_withTax='34',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='34',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '169';
UPDATE buybilldetail SET  lastbuyprice = 34 , meanbuyprice = 34, lastbuyprice_withDiscount = 34, meanbuyprice_withDiscount = 34
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where buybilldetailid = 241;
UPDATE productunit SET proUnitBuyPrice  = 34 * productnumber WHERE productid = 169;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-20' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '100', '0', '64', 'اضافة فاتورة مشتريات', 'buyBillController.php', '177', '277', '1', '2026-10-20 19:09:39','0','0'); -- id=5061
UPDATE supplier SET  suppliercurrentDebt = '5000.5',suppliercurrentDebtInCurrency= '5000.5' , userid = '1', supplierdate = '2026-10-20 19:14:35'   WHERE supplierid = '8';
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 ('8', '2712.50', '2288', '0', 'اضافة فاتورة مشتريات', '64', '5000.5', '2026-10-20 19:09:39', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','2288','1','2712.5','2288','5000.5','0',''); -- id=110
UPDATE save SET  savecurrentvalue = '-849592.75',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-843855.75','5737', '1', '1', 'اضافة فاتورة مشتريات', '64', '-849592.75', '2026-10-20 19:09:39', '1',  'buyBillController.php','0','','0'); -- id=378
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8025', '8025', '2026-10-20', '1', '0', '0', '2026-10-20 19:14:41','اضافة فاتورة مشتريات رقم 64','1','0',null,'0','64','buyBillController.php?do=details&id=64'); -- id=1838
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1838', '382', '8025', '','0'); -- id=1854
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2192874.8', 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 ('1838', '429', '8025', '','0'); -- id=1842
UPDATE accountstree SET name = 'محمد الفرسان ', customName = 'محمد الفرسان ', customNameEn = 'محمد الفرسان ', nameEn = 'محمد الفرسان ', parent = '81', accountNature = '1', theValue = '10737.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 10:36:58' WHERE id = '429';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5737', '5737', '2026-10-20', '1', '0', '0', '2026-10-20 19:14:41','اضافة فاتورة مشتريات رقم 64 - سداد الفاتورة للمورد','1','0',null,'0','64','buyBillController.php?do=details&id=64'); -- id=1839
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1839', '429', '5737', '','0'); -- id=1855
UPDATE accountstree SET name = 'محمد الفرسان ', customName = 'محمد الفرسان ', customNameEn = 'محمد الفرسان ', nameEn = 'محمد الفرسان ', parent = '81', accountNature = '1', theValue = '5000.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 10:36:58' WHERE id = '429';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1839', '383', '5737', '','0'); -- id=1843
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '202357.54', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
update buybill set dailyentryid='1838,1839' where buybillid=64;
COMMIT;
UPDATE product SET overAllAveragePrice = 21.5 WHERE productId = 168;UPDATE product SET overAllAveragePrice = 34 WHERE productId = 169;UPDATE product SET overAllAveragePrice = 7 WHERE productId = 172;UPDATE product SET overAllAveragePrice = 7 WHERE productId = 600;UPDATE product SET overAllAveragePrice = 7 WHERE productId = 613;UPDATE product SET overAllAveragePrice = 7 WHERE productId = 614;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:44:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:14:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-20 19:14:42', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=64'); -- id=4758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 15:46:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:16:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 19:16:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4759
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 16:24:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:54:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 19:54:47', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 16:26:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:56:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 19:56:06', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4761

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad7aae8343aa
-- ----------------------------------------------------------------------------------------------------

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-20 19:56:06', '06ad7aae8343aa', '1', '0.00', '0', '0', '1', '1710.00', '1710', '1710', '0', '1', '2026-10-20 19:56:06', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','1710','0','','0','0','1710','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=360
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','اضافة فاتورة مبيعات','360', '0', '2026-10-20 19:56:07', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1710', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-20 19:56:06','0','0','',''); -- id=613
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00266', '360', '10', '266', '2', '180', '360', '0', '', '0', '2026-10-20 19:56:07', '266', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','180','360','0','','0','','0','0','0','0'); -- id=2861
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 = 2861;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (266, '2026-10-20', 360, 320, 320
                    , 320, 320, 320, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 320, 320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 360, 320, 320
                    , 320, 320, 320, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 320, 320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-20 19:56:07' WHERE storedetailid = '266';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('266', '1', '2', '1', '360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '1', '1', '2026-10-20 19:56:07','0','0'); -- id=5062
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00284', '360', '7', '284', '10', '135', '1350', '0', '', '0', '2026-10-20 19:56:07', '284', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','135','1350','0','','0','0.00','0','0','0','0'); -- id=2862
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 2862;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-20', 1350, 1150, 1150
                    , 1150, 1150, 1150, 1150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 1150, 1150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1350, 1150, 1150
                    , 1150, 1150, 1150, 1150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1150, 1150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-20 19:56:08' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '10', '1', '360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26', '16', '1', '2026-10-20 19:56:08','0','0'); -- id=5063
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-847882.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 ('-849592.75','1710', '0', '1', 'اضافة فاتورة مبيعات', '360', '-847882.75', '2026-10-20 19:56:08', '1',  'sellbillController.php','1','','0'); -- id=379
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1710', '1710', '2026-10-20', '1', '0', '0', '2026-10-20 19:56:08','اضافة فاتورة مبيعات رقم 360','1','0',null,'0','360','sellbillController.php?do=showDetail&sellbillid=360'); -- id=1840
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1840', '383', '1710', '','0'); -- id=1856
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '204067.54', 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 ('1840', '143', '1710', '','0'); -- id=1844
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1544545.65', 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 ( '1470', '1470', '2026-10-20', '1', '0', '0', '2026-10-20 19:56:08','اضافة فاتورة مبيعات رقم 360 - صرف البضاعة من المخزن','1','0',null,'0','360','sellbillController.php?do=showDetail&sellbillid=360'); -- id=1841
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1841', '402', '1470', '','0'); -- id=1857
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1378482.7', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1841', '382', '1470', '','0'); -- id=1845
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2191404.8', 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='1840,0,1841' where sellbillid=360;
 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-20', 1710, 1470, 1470
                    , 1470, 1470, 1470, 1470
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1710, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1470
                        , returnSellVal = returnSellVal+0, 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-20', 1710, 1470, 1470
                    , 1470, 1470, 1470, 1470
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1710, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1470
                        , returnSellVal = returnSellVal+0, 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, 1710, 1470, 1470
                    , 1470, 1470, 1470, 1470, 1470, 1470)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1710, netSellCostBuyPrice = netSellCostBuyPrice+1470
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1470
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1470
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1470
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1470
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1470
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1470
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1470;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad7aae8343aa and sellbillId = 360 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 16:26:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 19:56:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 19:56:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4762
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 17:26:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 20:56:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 20:56:20', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-20 17:27:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-20 20:57:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-20 20:57:06', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4764

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad7b9619b216
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(74,@clientdebt,@clientname,@treeIdis);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-20 20:57:06', '06ad7b9619b216', '74', '3357.75', '2557.75', '0', '1', '800', '800', '0', '-800', '1', '2026-10-20 20:57:06', '', '1', '0', 'مصطفي نشات ','1', '1', '5', '0', 'مصطفي نشات ', '40', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=24
UPDATE client SET  clientdebt = '2557.75', userid = '1' WHERE clientid = '74';
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 ('74','3357.75','800','1','اضافة فاتورة مردوات مبيعات','24', '2557.75', '2026-10-20 20:57:06', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '800', '0', null, '0', null, null,'', '0','1','1','800','1','2026-10-20 20:57:06','0','0','',''); -- id=614
UPDATE client SET  inUse = 0 where clientid = 74;
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('14.00', '00206', '24', '6', '206', '40', '20', '800', '0', '', '1', '0', '206', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','20','800','0','','0'); -- id=122
UPDATE returnsellbilldetail SET  lastbuyprice = 14.00 , meanbuyprice = 14.00, lastbuyprice_withDiscount = 14.00, meanbuyprice_withDiscount = 14.00
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where returnsellbilldetailid = 122;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (206, '2026-10-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 800, 560, 560, 560
                    , 560, 560, 560, 0, 40, 0, 0, 560, 560)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+800, returnSellCostBuyPrice = returnSellCostBuyPrice+560, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+560
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+560, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+560
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+560
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+560
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+560
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+560
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+40;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 800, 560, 560, 560
                    , 560, 560, 560, 0, 0, 560, 560)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+800, returnSellCostBuyPrice = returnSellCostBuyPrice+560, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+560
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+560, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+560
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+560
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+560
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+560
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+560;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-20 20:57:06' WHERE storedetailid = '206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('206', '1', '40', '0', '24', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '5', '45', '1', '2026-10-20 20:57:06','0','0'); -- id=5064
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '800', '800', '2026-10-20', '1', '0', '0', '2026-10-20 20:57:07','اضافة فاتورة مردود مبيعات رقم 24','1','0',null,'0','24','returnsellbillController.php?do=showDetail&returnsellbillid=24'); -- id=1842
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1842', '143', '800', '','0'); -- id=1858
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1543745.65', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1842', '507', '800', '','0'); -- id=1846
UPDATE accountstree SET name = 'مصطفي نشات ', customName = 'مصطفي نشات ', customNameEn = 'مصطفي نشات ', nameEn = 'مصطفي نشات ', parent = '58', accountNature = '0', theValue = '2557.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 15:46:52' WHERE id = '507';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '560', '560', '2026-10-20', '1', '0', '0', '2026-10-20 20:57:07','اضافة فاتورة مردود مبيعات رقم 24 - صرف البضاعة من المخزن','1','0',null,'0','24','returnsellbillController.php?do=showDetail&returnsellbillid=24'); -- id=1843
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1843', '382', '560', '','0'); -- id=1859
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2191964.8', 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 ('1843', '402', '560', '','0'); -- id=1847
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1377922.7', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='1842,0,1843' where returnsellbillid=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-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 800, 560, 560, 560
                    , 560, 560, 560 ,0, 0, 560, 560)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+800, returnSellCostBuyPrice = returnSellCostBuyPrice+560, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+560
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+560, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+560
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+560
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+560
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+560
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+560;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (74, '2026-10-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 800, 560, 560, 560
                    , 560, 560, 560 ,0, 0, 560, 560)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+800, returnSellCostBuyPrice = returnSellCostBuyPrice+560, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+560
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+560, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+560
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+560
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+560
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+560
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+560;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -800, -560, -560
                    , -560, -560, -560, -560, -560, -560)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-800, netSellCostBuyPrice = netSellCostBuyPrice+-560
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-560
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-560
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-560
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-560
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-560
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-560
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-560;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad7b9619b216 and sellbillId = 24 and returnsellbillId = 24
-- ----------------------------------------------------------------------------------------------------

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