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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab76499ba167
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 08:23:29', '06ab76499ba167', '1', '0.00', '0', '0', '1', '4110.00', '4110', '4110', '0', '1', '2026-09-26 08:23:29', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '110' ,'0','','','','','-1','0','0','0','0','0','4110','0','','0','0','4110','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','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=125
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','اضافة فاتورة مبيعات','125', '0', '2026-09-26 08:23:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4110', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 08:23:29','0','0','',''); -- 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 ('42.72','00182', '125', '20', '182', '50', '44.5', '2225', '0', '', '0', '2026-09-26 08:23:29', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','44.5','2225','0','','0','','0','0','0','0'); -- id=902
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 902;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-09-26', 2225, 2136, 2136
                    , 2136, 2136, 2136, 2136
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 2136, 2136, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2225, sellCostBuyPrice =sellCostBuyPrice+2136
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2136, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2136
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2136, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2136
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2136
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2136
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2136
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 2225, 2136, 2136
                    , 2136, 2136, 2136, 2136
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2136, 2136, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2225, sellCostBuyPrice =sellCostBuyPrice+2136
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2136, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2136
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2136, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2136
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2136
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2136
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2136
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-26 08:23:30' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '50', '1', '125', 'اضافة فاتورة مبيعات', 'sellbillController.php', '922', '872', '1', '2026-09-26 08:23:30','0','0'); -- id=1888
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('32.95','00181', '125', '20', '181', '50', '34', '1700', '0', '', '0', '2026-09-26 08:23:30', '181', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','34','1700','0','','0','0.00','0','0','0','0'); -- id=903
UPDATE sellbilldetail SET  lastbuyprice = 32.95 , meanbuyprice = 32.95, lastbuyprice_withDiscount = 32.95, meanbuyprice_withDiscount = 32.95
        , lastbuyprice_withTax = 32.95, meanbuyprice_withTax = 32.95, lastbuyprice_withDiscountAndTax = 32.95
                where sellbilldetailid = 903;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (181, '2026-09-26', 1700, 1647.5, 1647.5
                    , 1647.5, 1647.5, 1647.5, 1647.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 1647.5, 1647.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1700, sellCostBuyPrice =sellCostBuyPrice+1647.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1647.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1647.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1647.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1647.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1647.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1647.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1647.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1700, 1647.5, 1647.5
                    , 1647.5, 1647.5, 1647.5, 1647.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1647.5, 1647.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1700, sellCostBuyPrice =sellCostBuyPrice+1647.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1647.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1647.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1647.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1647.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1647.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1647.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1647.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 = '20', userid = '1', storedetaildate = '2026-09-26 08:23:30' WHERE storedetailid = '181';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '1', '50', '1', '125', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '20', '1', '2026-09-26 08:23:30','0','0'); -- id=1889
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '125', '14', '81', '10', '18.5', '185', '0', '', '0', '2026-09-26 08:23:30', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','185','0','','0','0.00','0','0','0','0'); -- id=904
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 = 904;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-09-26', 185, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+185, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 185, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+185, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '520', userid = '1', storedetaildate = '2026-09-26 08:23:30' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '125', 'اضافة فاتورة مبيعات', 'sellbillController.php', '530', '520', '1', '2026-09-26 08:23:30','0','0'); -- id=1890
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-328303.875',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-332413.875','4110', '0', '1', 'اضافة فاتورة مبيعات', '125', '-328303.875', '2026-09-26 08:23:30', '1',  'sellbillController.php','1','','0'); -- id=130
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4110', '4110', '2026-09-26', '1', '0', '0', '2026-09-26 08:23:30','اضافة فاتورة مبيعات رقم 125','1','0',null,'0','125','sellbillController.php?do=showDetail&sellbillid=125'); -- id=941
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('941', '383', '4110', '','0'); -- id=941
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-280936.85', 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 ('941', '143', '4110', '','0'); -- id=941
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '429591.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3963.5', '3963.5', '2026-09-26', '1', '0', '0', '2026-09-26 08:23:30','اضافة فاتورة مبيعات رقم 125 - صرف البضاعة من المخزن','1','0',null,'0','125','sellbillController.php?do=showDetail&sellbillid=125'); -- id=942
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('942', '402', '3963.5', '','0'); -- id=942
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '400257.53', 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 ('942', '382', '3963.5', '','0'); -- id=942
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2440029.94', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='941,0,942' where sellbillid=125;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 4110, 3963.5, 3963.5
                    , 3963.5, 3963.5, 3963.5, 3963.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3963.5, 3963.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4110, sellCostBuyPrice =sellCostBuyPrice+3963.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3963.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3963.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3963.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3963.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3963.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3963.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3963.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 4110, 3963.5, 3963.5
                    , 3963.5, 3963.5, 3963.5, 3963.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3963.5, 3963.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4110, sellCostBuyPrice =sellCostBuyPrice+3963.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3963.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3963.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3963.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3963.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3963.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3963.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3963.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, 4110, 3963.5, 3963.5
                    , 3963.5, 3963.5, 3963.5, 3963.5, 3963.5, 3963.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4110, netSellCostBuyPrice = netSellCostBuyPrice+3963.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3963.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3963.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3963.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3963.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3963.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3963.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3963.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab76499ba167 and sellbillId = 125 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 04:53:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 08:23:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 08:23:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2398
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 04:54:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 08:24:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 08:24:43', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=125'); -- id=2399
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 04:55:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 08:25:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 08:25:07', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2400
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 04:55:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 08:25:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 08:25:11', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=125'); -- id=2401
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 04:58:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 08:28:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 08:28:10', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2402
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 05:39:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 09:09:06', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2403
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 05:39:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:09:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 09:09:07', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2404
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 06:13:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:43:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 09:43:46', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2405
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 06:14:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:44:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 09:44:10', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2406
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 ('لفه سوسته 23 ملي احمر ','','12','50','50','50','50','2026-09-26','0','1','0','','0','0','0','0','0','50','50','50','50','50','0','0','0','0','.','0','0','0','50','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','50','50','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','50','0','0','0','0','0','0','','','0','0','0','0'); -- id=520
UPDATE product SET productName = 'لفه سوسته 23 ملي احمر ', productDescription = '', productCatId = '12', productBuyPrice = '50', productSellAllPrice = '50', productSellUnitPrice = '50', productSellHalfPrice = '50', productDate = '2026-09-26', conditions = '0', userId = '1', limitamount = '0', parcode = '00520',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '50',lastbuyprice_withDiscount = '50',meanbuyprice = '50',meanbuyprice_withDiscount = '50' , productbuypricereal = '50' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='50',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='50',meanbuyprice_withTax='50',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='50',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '520';
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', '520', '1.00', '2026-09-26', '1', '0','0052001','50','50','50','50','','0','0','0','0','0','0','0','0','0','0'); -- id=520
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('520', '1', '10', '1', '2026-09-26'); -- id=520
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('520', '1', '10', '0', '520', 'إضافة منتج', 'productController.php', '0', '10', '1', '2026-09-26','0','0'); -- id=1891
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (520, 1,'2026-09-26 09:44:12',1)
                ON DUPLICATE KEY UPDATE productid = 520, edited = 1, sysdate = '2026-09-26 09:44:12', userid = 1; -- id=647
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '500', '500', '2026-09-26', '1', '0', '0', '2026-09-26 09:44:12','إضافة منتج لفه سوسته 23 ملي احمر  الكمية 10','1','0','0','0','520','productController.php?do=edit&id=520'); -- id=943
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('943', '382', '500', '','0'); -- id=943
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2440529.94', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('943', '121', '500', '','0'); -- id=943
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1514691.87', 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 = 'لفه سوسته 23 ملي احمر ', productDescription = '', productCatId = '12', productBuyPrice = '50.00', productSellAllPrice = '50.00', productSellUnitPrice = '50.00', productSellHalfPrice = '50.00', productDate = '2026-09-26', conditions = '0', userId = '1', limitamount = '0', parcode = '00520',type ='0', expireDate = '0' , dailyentryId = '943',isService = '0',isOptic = '0',lastbuyprice = '50',lastbuyprice_withDiscount = '50',meanbuyprice = '50',meanbuyprice_withDiscount = '50' , productbuypricereal = '50' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='50',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='50',meanbuyprice_withTax='50',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='50',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '520';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 06:14:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:44:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 09:44:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2407
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 06:14:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 09:44:58', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2408

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab76601ce104
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(7,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 09:44:58', '06ab76601ce104', '7', '1938.00', '7540', '0', '1', '5602.00', '5602', '0', '5602', '1', '2026-09-26 09:44:58', '', '1', '0', 'سامي الشربيني', '1', '1', '3', '0', '7 - سامي الشربيني', '138' ,'0','','','','','-1','0','0','0','0','0','5602','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','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=126
UPDATE client SET  clientdebt = '7540', userid = '1' WHERE clientid = '7';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('7','1938.00','5602','0','اضافة فاتورة مبيعات','126', '7540', '2026-09-26 09:44:59', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5602', '0', null, '0', null, null,'', '0','1','1','5602','1','2026-09-26 09:44:58','0','0','',''); -- id=211
UPDATE client SET  inUse = 0 where clientid = 7;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('645','00219', '126', '13', '219', '1', '670', '670', '0', '', '0', '2026-09-26 09:44:59', '219', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','670','670','0','','0','','0','0','0','0'); -- id=905
UPDATE sellbilldetail SET  lastbuyprice = 645.00 , meanbuyprice = 645.00, lastbuyprice_withDiscount = 645.00, meanbuyprice_withDiscount = 645.00
        , lastbuyprice_withTax = 645, meanbuyprice_withTax = 645, lastbuyprice_withDiscountAndTax = 645
                where sellbilldetailid = 905;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (219, '2026-09-26', 670, 645, 645
                    , 645, 645, 645, 645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 645, 645, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+645
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 670, 645, 645
                    , 645, 645, 645, 645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 645, 645, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+645
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-26 09:44:59' WHERE storedetailid = '219';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('219', '1', '1', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-26 09:44:59','0','0'); -- id=1892
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00178', '126', '19', '178', '10', '80', '800', '0', '', '0', '2026-09-26 09:44:59', '178', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','80','800','0','','0','0.00','0','0','0','0'); -- id=906
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 906;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (178, '2026-09-26', 800, 770, 770
                    , 770, 770, 770, 770
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 770, 770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+770
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+770
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 800, 770, 770
                    , 770, 770, 770, 770
                    , 0, 0, 0, 0
                    , 0, 0, 0, 770, 770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+770
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+770
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '65', userid = '1', storedetaildate = '2026-09-26 09:45:00' WHERE storedetailid = '178';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('178', '1', '10', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '65', '1', '2026-09-26 09:45:00','0','0'); -- id=1893
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('55.5','00177', '126', '19', '177', '10', '58', '580', '0', '', '0', '2026-09-26 09:45:00', '177', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','58','580','0','','0','0.00','0','0','0','0'); -- id=907
UPDATE sellbilldetail SET  lastbuyprice = 55.50 , meanbuyprice = 55.50, lastbuyprice_withDiscount = 55.50, meanbuyprice_withDiscount = 55.50
        , lastbuyprice_withTax = 55.5, meanbuyprice_withTax = 55.5, lastbuyprice_withDiscountAndTax = 55.5
                where sellbilldetailid = 907;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (177, '2026-09-26', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '111', userid = '1', storedetaildate = '2026-09-26 09:45:00' WHERE storedetailid = '177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('177', '1', '10', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '121', '111', '1', '2026-09-26 09:45:00','0','0'); -- id=1894
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 26;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21.5','00168', '126', '2', '168', '10', '24.5', '245', '0', '', '0', '2026-09-26 09:45:00', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','26-10,','1','1','0','0','24.5','245','0','','0','0.00','0','0','0','0'); -- id=908
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 908;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-09-26', 245, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+245, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 245, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+245, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '248', userid = '1', storedetaildate = '2026-09-26 09:45:00' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '10', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '258', '248', '1', '2026-09-26 09:45:00','0','0'); -- id=1895
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26.25','00240', '126', '2', '240', '10', '27', '270', '0', '', '0', '2026-09-26 09:45:00', '240', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','27','270','0','','0','0.00','0','0','0','0'); -- id=909
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 909;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-09-26', 270, 262.5, 262.5
                    , 262.5, 262.5, 262.5, 262.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 262.5, 262.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+262.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+262.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+262.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+262.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+262.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+262.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+262.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+262.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 270, 262.5, 262.5
                    , 262.5, 262.5, 262.5, 262.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 262.5, 262.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+262.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+262.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+262.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+262.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+262.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+262.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+262.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+262.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 = '245', userid = '1', storedetaildate = '2026-09-26 09:45:01' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '10', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '255', '245', '1', '2026-09-26 09:45:01','0','0'); -- id=1896
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('32.76','00306', '126', '4', '306', '5', '34', '170', '0', '', '0', '2026-09-26 09:45:01', '306', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','34','170','0','','0','0.00','0','0','0','0'); -- id=910
UPDATE sellbilldetail SET  lastbuyprice = 32.76 , meanbuyprice = 32.76, lastbuyprice_withDiscount = 32.76, meanbuyprice_withDiscount = 32.76
        , lastbuyprice_withTax = 32.76, meanbuyprice_withTax = 32.76, lastbuyprice_withDiscountAndTax = 32.76
                where sellbilldetailid = 910;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (306, '2026-09-26', 170, 163.8, 163.8
                    , 163.8, 163.8, 163.8, 163.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 163.8, 163.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163.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+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 170, 163.8, 163.8
                    , 163.8, 163.8, 163.8, 163.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 163.8, 163.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163.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 = '13', userid = '1', storedetaildate = '2026-09-26 09:45:01' WHERE storedetailid = '306';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('306', '1', '5', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '13', '1', '2026-09-26 09:45:01','0','0'); -- id=1897
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14','00279', '126', '4', '279', '30', '14.6', '438', '0', '', '0', '2026-09-26 09:45:01', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','14.6','438','0','','0','0.00','0','0','0','0'); -- id=911
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 = 911;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (279, '2026-09-26', 438, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+438, 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+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 438, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+438, 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 = '58', userid = '1', storedetaildate = '2026-09-26 09:45:01' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '30', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '88', '58', '1', '2026-09-26 09:45:01','0','0'); -- id=1898
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '126', '4', '280', '30', '14.3', '429', '0', '', '0', '2026-09-26 09:45:01', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','14.3','429','0','','0','0.00','0','0','0','0'); -- id=912
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 = 912;
 INSERT INTO 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-09-26', 429, 414, 414
                    , 414, 414, 414, 414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 414, 414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+429, sellCostBuyPrice =sellCostBuyPrice+414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+414
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 429, 414, 414
                    , 414, 414, 414, 414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 414, 414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+429, sellCostBuyPrice =sellCostBuyPrice+414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+414
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-09-26 09:45:02' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '30', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '120', '1', '2026-09-26 09:45:02','0','0'); -- id=1899
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '126', '19', '175', '2', '330', '660', '0', '', '0', '2026-09-26 09:45:02', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','330','660','0','','0','0.00','0','0','0','0'); -- id=913
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 = 913;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-09-26', 660, 650, 650
                    , 650, 650, 650, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 650, 650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 660, 650, 650
                    , 650, 650, 650, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 650, 650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-09-26 09:45:02' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '2', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '41', '39', '1', '2026-09-26 09:45:02','0','0'); -- id=1900
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00176', '126', '19', '176', '20', '42', '840', '0', '', '0', '2026-09-26 09:45:02', '176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','42','840','0','','0','0.00','0','0','0','0'); -- id=914
UPDATE sellbilldetail SET  lastbuyprice = 39.00 , meanbuyprice = 39.00, lastbuyprice_withDiscount = 39.00, meanbuyprice_withDiscount = 39.00
        , lastbuyprice_withTax = 39, meanbuyprice_withTax = 39, lastbuyprice_withDiscountAndTax = 39
                where sellbilldetailid = 914;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (176, '2026-09-26', 840, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+840, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 840, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+840, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-09-26 09:45:02' WHERE storedetailid = '176';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('176', '1', '20', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '36', '1', '2026-09-26 09:45:02','0','0'); -- id=1901
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00520', '126', '12', '520', '10', '50', '500', '0', '', '0', '2026-09-26 09:45:02', '520', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','50','500','0','','0','0.00','0','0','0','0'); -- id=915
UPDATE sellbilldetail SET  lastbuyprice = 50.00 , meanbuyprice = 50.00, lastbuyprice_withDiscount = 50.00, meanbuyprice_withDiscount = 50.00
        , lastbuyprice_withTax = 50, meanbuyprice_withTax = 50, lastbuyprice_withDiscountAndTax = 50
                where sellbilldetailid = 915;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (520, '2026-09-26', 500, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 500, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-26 09:45:03' WHERE storedetailid = '520';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('520', '1', '10', '1', '126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '0', '1', '2026-09-26 09:45:03','0','0'); -- id=1902
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5602', '5602', '2026-09-26', '1', '0', '0', '2026-09-26 09:45:03','اضافة فاتورة مبيعات رقم 126','1','0',null,'0','126','sellbillController.php?do=showDetail&sellbillid=126'); -- id=944
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('944', '434', '5602', '','0'); -- id=944
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '7540', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('944', '143', '5602', '','0'); -- id=944
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '435193.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5375.3', '5375.3', '2026-09-26', '1', '0', '0', '2026-09-26 09:45:03','اضافة فاتورة مبيعات رقم 126 - صرف البضاعة من المخزن','1','0',null,'0','126','sellbillController.php?do=showDetail&sellbillid=126'); -- id=945
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('945', '402', '5375.3', '','0'); -- id=945
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '405632.83', 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 ('945', '382', '5375.3', '','0'); -- id=945
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2435154.64', 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='944,0,945' where sellbillid=126;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 5602, 5375.3, 5375.3
                    , 5375.3, 5375.3, 5375.3, 5375.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5375.3, 5375.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5602, sellCostBuyPrice =sellCostBuyPrice+5375.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5375.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5375.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5375.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5375.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5375.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5375.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5375.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (7, '2026-09-26', 5602, 5375.3, 5375.3
                    , 5375.3, 5375.3, 5375.3, 5375.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5375.3, 5375.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5602, sellCostBuyPrice =sellCostBuyPrice+5375.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5375.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5375.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5375.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5375.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5375.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5375.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5375.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5602, 5375.3, 5375.3
                    , 5375.3, 5375.3, 5375.3, 5375.3, 5375.3, 5375.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5602, netSellCostBuyPrice = netSellCostBuyPrice+5375.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5375.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5375.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5375.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5375.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5375.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5375.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5375.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab76601ce104 and sellbillId = 126 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 06:15:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 09:45:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 09:45:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2409
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:30:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:00:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:00:30', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2410

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab778021d33e
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab778021d33e and sellbillId = 127 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:30:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:00:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:00:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2411
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:30:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:00:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:00:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2412
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:31:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:01:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:01:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2413
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:31:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:01:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:01:05', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=127'); -- id=2414
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 07:31:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:01:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:01:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2415
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:24:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:54:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:54:42', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2416

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab789e32335f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 11:54:43', '06ab789e32335f', '1', '0.00', '0', '0', '1', '1550.00', '1550', '1550', '0', '1', '2026-09-26 11:54:43', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','1550','0','','0','0','1550','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=128
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','اضافة فاتورة مبيعات','128', '0', '2026-09-26 11:54:44', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1550', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 11:54:43','0','0','',''); -- id=213
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 50;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1282','00202', '128', '6', '202', '1', '1550', '1550', '0', '', '1', '2026-09-26 11:54:44', '202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','50-1,','1','1','0','0','1550','1550','0','','0','0.00','0','0','0','0'); -- id=917
UPDATE sellbilldetail SET  lastbuyprice = 1282.00 , meanbuyprice = 1271.33, lastbuyprice_withDiscount = 1282.00, meanbuyprice_withDiscount = 1271.33
        , lastbuyprice_withTax = 1282, meanbuyprice_withTax = 1271.33, lastbuyprice_withDiscountAndTax = 1282
                where sellbilldetailid = 917;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (202, '2026-09-26', 1550, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1550, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-09-26 11:54:44' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '1', '128', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '7', '1', '2026-09-26 11:54:44','0','0'); -- id=1904
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-326753.875',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-328303.875','1550', '0', '1', 'اضافة فاتورة مبيعات', '128', '-326753.875', '2026-09-26 11:54:44', '1',  'sellbillController.php','1','','0'); -- id=131
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1550', '1550', '2026-09-26', '1', '0', '0', '2026-09-26 11:54:44','اضافة فاتورة مبيعات رقم 128','1','0',null,'0','128','sellbillController.php?do=showDetail&sellbillid=128'); -- id=948
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('948', '383', '1550', '','0'); -- id=948
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-279386.85', 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 ('948', '143', '1550', '','0'); -- id=948
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '440463.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1282', '1282', '2026-09-26', '1', '0', '0', '2026-09-26 11:54:44','اضافة فاتورة مبيعات رقم 128 - صرف البضاعة من المخزن','1','0',null,'0','128','sellbillController.php?do=showDetail&sellbillid=128'); -- id=949
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('949', '402', '1282', '','0'); -- id=949
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '409974.83', 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 ('949', '382', '1282', '','0'); -- id=949
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2430812.64', 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='948,0,949' where sellbillid=128;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 1550, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1550, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1550, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282, 1282, 1271.33)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1550, netSellCostBuyPrice = netSellCostBuyPrice+1282
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1282
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1271.33
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1282
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1271.33
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1282
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1282
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1271.33;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab789e32335f and sellbillId = 128 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:24:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:54:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:54:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2417
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:24:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:54:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 11:54:51', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2418
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:24:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:54:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:54:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2419
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:25:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:55:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 11:55:25', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2420
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:26:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:56:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 11:56:25', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2421
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 ('06ab796931bb34', '2026-09-26 11:55:31', '1', '42113.50', '42113.5', '0', '0', '1260.00',  '1260.00', '1260', '0', '1', '2026-09-26 11:56:26', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=25
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 ('00206', '25', '6', '206', '90', '14', '1260.00', '0', '', '2026-09-26 11:56:26', '206','','','0','0','0','0','0',null,'14','1260','0','0','0','0','0','0','0','0','1'); -- id=91
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 11:55:31', 1, 206, 0, 0
                    , 14, 90, 0, 0, 1, '2026-09-26 11:56:26')
                ON DUPLICATE KEY UPDATE buyprice = 14,
                        buyQuantity =buyQuantity+90, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 11:56:26' ; -- id=91
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('206', '14', '90', '0', 'buyBillController.php', '91', '', '0', '0'); -- id=91
UPDATE product SET  productBuyPrice = "14" WHERE productId = 206 ;
UPDATE buybilldetail SET  quantitybefore = 8 WHERE buybilldetailid = 91 ;
UPDATE product SET productName = 'متر ليد ويرليس دبل ورم ', productDescription = '', productCatId = '6', productBuyPrice = '14.00', productSellAllPrice = '14.00', productSellUnitPrice = '19.00', productSellHalfPrice = '14.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00206',type ='0', expireDate = '0' , dailyentryId = '233',isService = '0',isOptic = '0',lastbuyprice = '14',lastbuyprice_withDiscount = '14',meanbuyprice = '14',meanbuyprice_withDiscount = '14' , productbuypricereal = '14.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '35.71',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='14',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='14',meanbuyprice_withTax='14',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='14',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '206';
UPDATE buybilldetail SET  lastbuyprice = 14 , meanbuyprice = 14, lastbuyprice_withDiscount = 14, meanbuyprice_withDiscount = 14
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where buybilldetailid = 91;
UPDATE productunit SET proUnitBuyPrice  = 14 * productnumber WHERE productid = 206;
UPDATE storedetail SET  productquantity = '98', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('206', '1', '90', '0', '25', 'اضافة فاتورة مشتريات', 'buyBillController.php', '8', '98', '1', '2026-09-26 11:55:31','0','0'); -- id=1905
UPDATE supplier SET  suppliercurrentDebt = '42113.5',suppliercurrentDebtInCurrency= '42113.5' , userid = '1', supplierdate = '2026-09-26 11:56:26'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '42113.50', '0', '0', 'اضافة فاتورة مشتريات', '25', '42113.5', '2026-09-26 11:55:31', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','42113.5','0','42113.5','0',''); -- id=51
UPDATE save SET  savecurrentvalue = '-328013.88',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-326753.88','1260', '1', '1', 'اضافة فاتورة مشتريات', '25', '-328013.88', '2026-09-26 11:55:31', '1',  'buyBillController.php','0','','0'); -- id=132
update buybill set dailyentryid='0,0' where buybillid=25;
COMMIT;
UPDATE product SET overAllAveragePrice = 14 WHERE productId = 206;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:26:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:56:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 11:56:28', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=25'); -- id=2422
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:27:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 11:57:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 11:57:08', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2423

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7966fadad6
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 11:57:09', '06ab7966fadad6', '1', '0.00', '0', '0', '1', '1370.00', '1370', '1370', '0', '1', '2026-09-26 11:57:09', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '74' ,'0','','','','','-1','0','0','0','0','0','1370','0','','0','0','1370','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=129
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','اضافة فاتورة مبيعات','129', '0', '2026-09-26 11:57:09', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1370', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 11:57:09','0','0','',''); -- id=214
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 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', '129', '6', '206', '50', '19', '950', '0', '', '1', '2026-09-26 11:57:10', '206', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','91-50,','1','1','0','0','19','950','0','','0','0.00','0','0','0','0'); -- id=918
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 = 918;
 INSERT INTO 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-09-26', 950, 700, 700
                    , 700, 700, 700, 700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 700, 700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 950, 700, 700
                    , 700, 700, 700, 700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 700, 700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-09-26 11:57:10' WHERE storedetailid = '206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('206', '1', '50', '1', '129', 'اضافة فاتورة مبيعات', 'sellbillController.php', '98', '48', '1', '2026-09-26 11:57:10','0','0'); -- id=1906
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00373', '129', '6', '373', '20', '18', '360', '0', '', '1', '2026-09-26 11:57:10', '373', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','18','360','0','','0','0.00','0','0','0','0'); -- id=919
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 = 919;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (373, '2026-09-26', 360, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 360, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-09-26 11:57:10' WHERE storedetailid = '373';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('373', '1', '20', '1', '129', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '60', '1', '2026-09-26 11:57:10','0','0'); -- id=1907
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '129', '6', '207', '4', '15', '60', '0', '', '1', '2026-09-26 11:57:10', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','60','0','','0','0.00','0','0','0','0'); -- id=920
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 = 920;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-09-26', 60, 44, 44
                    , 44, 44, 44, 44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44, 44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 60, 44, 44
                    , 44, 44, 44, 44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44, 44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-26 11:57:11' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '4', '1', '129', 'اضافة فاتورة مبيعات', 'sellbillController.php', '128', '124', '1', '2026-09-26 11:57:11','0','0'); -- id=1908
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-326643.875',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-328013.875','1370', '0', '1', 'اضافة فاتورة مبيعات', '129', '-326643.875', '2026-09-26 11:57:11', '1',  'sellbillController.php','1','','0'); -- id=133
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1370', '1370', '2026-09-26', '1', '0', '0', '2026-09-26 11:57:11','اضافة فاتورة مبيعات رقم 129','1','0',null,'0','129','sellbillController.php?do=showDetail&sellbillid=129'); -- id=950
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('950', '383', '1370', '','0'); -- id=950
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-278016.85', 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 ('950', '143', '1370', '','0'); -- id=950
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '441833.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '984', '984', '2026-09-26', '1', '0', '0', '2026-09-26 11:57:11','اضافة فاتورة مبيعات رقم 129 - صرف البضاعة من المخزن','1','0',null,'0','129','sellbillController.php?do=showDetail&sellbillid=129'); -- id=951
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('951', '402', '984', '','0'); -- id=951
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '410958.83', 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 ('951', '382', '984', '','0'); -- id=951
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2429828.64', 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='950,0,951' where sellbillid=129;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 1370, 984, 984
                    , 984, 984, 984, 984
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,984, 984, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1370, sellCostBuyPrice =sellCostBuyPrice+984
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+984, sellCostMeanBuyPrice = sellCostMeanBuyPrice+984
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+984, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+984
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+984
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+984
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+984
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1370, 984, 984
                    , 984, 984, 984, 984
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,984, 984, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1370, sellCostBuyPrice =sellCostBuyPrice+984
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+984, sellCostMeanBuyPrice = sellCostMeanBuyPrice+984
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+984, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+984
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+984
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+984
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+984
                        , returnSellVal = returnSellVal+0, 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, 1370, 984, 984
                    , 984, 984, 984, 984, 984, 984)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1370, netSellCostBuyPrice = netSellCostBuyPrice+984
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+984
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+984
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+984
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+984
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+984
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+984
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+984;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7966fadad6 and sellbillId = 129 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab798ee5ed8b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 12:06:36', '06ab798ee5ed8b', '18', '520.00', '723', '0', '1', '203.00', '203', '0', '203', '1', '2026-09-26 12:06:36', '', '1', '0', 'محمد السعيد صالح ', '1', '1', '3', '0', 'محمد السعيد صالح ', '16' ,'0','','','','','-1','0','0','0','0','0','203','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=130
UPDATE client SET  clientdebt = '723', userid = '1' WHERE clientid = '18';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('18','520.00','203','0','اضافة فاتورة مبيعات','130', '723', '2026-09-26 12:06:37', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '203', '0', null, '0', null, null,'', '0','1','1','203','1','2026-09-26 12:06:36','0','0','',''); -- id=215
UPDATE client SET  inUse = 0 where clientid = 18;
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', '130', '12', '83', '2', '45', '90', '0', '', '1', '2026-09-26 12:06:37', '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=921
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 = 921;
 INSERT INTO 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-09-26', 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-09-26', 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 = '278', userid = '1', storedetaildate = '2026-09-26 12:06:37' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '280', '278', '1', '2026-09-26 12:06:37','0','0'); -- id=1909
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '130', '12', '86', '10', '6.5', '65', '0', '', '1', '2026-09-26 12:06:37', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.5','65','0','','0','0.00','0','0','0','0'); -- id=922
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 922;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '435', userid = '1', storedetaildate = '2026-09-26 12:06:38' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '1', '130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '445', '435', '1', '2026-09-26 12:06:38','0','0'); -- id=1910
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00088', '130', '12', '88', '4', '12', '48', '0', '', '1', '2026-09-26 12:06:38', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','48','0','','0','0.00','0','0','0','0'); -- id=923
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 923;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.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+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.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 = '124', userid = '1', storedetaildate = '2026-09-26 12:06:38' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '1', '130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '128', '124', '1', '2026-09-26 12:06:38','0','0'); -- id=1911
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '203', '203', '2026-09-26', '1', '0', '0', '2026-09-26 12:06:38','اضافة فاتورة مبيعات رقم 130','1','0',null,'0','130','sellbillController.php?do=showDetail&sellbillid=130'); -- id=952
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('952', '447', '203', '','0'); -- id=952
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '723', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('952', '143', '203', '','0'); -- id=952
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '442036.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '182.6', '182.6', '2026-09-26', '1', '0', '0', '2026-09-26 12:06:38','اضافة فاتورة مبيعات رقم 130 - صرف البضاعة من المخزن','1','0',null,'0','130','sellbillController.php?do=showDetail&sellbillid=130'); -- id=953
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('953', '402', '182.6', '','0'); -- id=953
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '411141.43', 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 ('953', '382', '182.6', '','0'); -- id=953
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2429646.04', 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='952,0,953' where sellbillid=130;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,182.6, 185.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+203, sellCostBuyPrice =sellCostBuyPrice+182.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+185.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-26', 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,182.6, 185.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+203, sellCostBuyPrice =sellCostBuyPrice+182.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+185.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6, 182.6, 185.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+203, netSellCostBuyPrice = netSellCostBuyPrice+182.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+182.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+185.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+182.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+185.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+182.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+182.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+185.2;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab798ee5ed8b and sellbillId = 130 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:36:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 12:06:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 12:06:39', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2427
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:36:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 12:06:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 12:06:52', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2428
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:38:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 12:08:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 12:08:15', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2429
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 ('06ab7993d6fa0a', '2026-09-26 12:06:53', '1', '42113.50', '42113.5', '0', '0', '4170.00',  '4170.00', '4170', '0', '1', '2026-09-26 12:08:15', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=26
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 ('00280', '26', '4', '280', '150', '13.8', '2070.00', '0', '', '2026-09-26 12:08:15', '280','','','0','0','0','0','0',null,'13.8','2070','0','0','0','0','0','0','0','0','1'); -- id=92
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 12:06:53', 1, 280, 0, 0
                    , 13.8, 150, 0, 0, 1, '2026-09-26 12:08:16')
                ON DUPLICATE KEY UPDATE buyprice = 13.8,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 12:08:16' ; -- id=92
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('280', '13.8', '150', '0', 'buyBillController.php', '92', '', '0', '0'); -- id=92
UPDATE product SET  productBuyPrice = "13.8" WHERE productId = 280 ;
UPDATE buybilldetail SET  quantitybefore = 120 WHERE buybilldetailid = 92 ;
UPDATE product SET productName = 'مفتاح مفرد ', productDescription = '', productCatId = '4', productBuyPrice = '13.80', productSellAllPrice = '14.30', productSellUnitPrice = '14.30', productSellHalfPrice = '14.30', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00280',type ='0', expireDate = '0' , dailyentryId = '331',isService = '0',isOptic = '0',lastbuyprice = '13.8',lastbuyprice_withDiscount = '13.8',meanbuyprice = '13.8',meanbuyprice_withDiscount = '13.8' , productbuypricereal = '13.80' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.62' , buyhalf_precentage = '3.62' , buypart_precentage = '3.62',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13.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='13.8',meanbuyprice_withTax='13.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='13.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 = '280';
UPDATE buybilldetail SET  lastbuyprice = 13.8 , meanbuyprice = 13.8, lastbuyprice_withDiscount = 13.8, meanbuyprice_withDiscount = 13.8
        , lastbuyprice_withTax = 13.8, meanbuyprice_withTax = 13.8, lastbuyprice_withDiscountAndTax = 13.8
                where buybilldetailid = 92;
UPDATE productunit SET proUnitBuyPrice  = 13.8 * productnumber WHERE productid = 280;
UPDATE storedetail SET  productquantity = '270', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '150', '0', '26', 'اضافة فاتورة مشتريات', 'buyBillController.php', '120', '270', '1', '2026-09-26 12:06:53','0','0'); -- id=1912
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 ('00279', '26', '4', '279', '150', '14', '2100.00', '0', '', '2026-09-26 12:08:15', '279','','','0','0','0','0','0',null,'14','2100','0','0','0','0','0','0','0','0','1'); -- id=93
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 12:06:53', 1, 279, 0, 0
                    , 14, 150, 0, 0, 1, '2026-09-26 12:08:17')
                ON DUPLICATE KEY UPDATE buyprice = 14,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 12:08:17' ; -- id=93
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('279', '14', '150', '0', 'buyBillController.php', '93', '', '0', '0'); -- id=93
UPDATE product SET  productBuyPrice = "14" WHERE productId = 279 ;
UPDATE buybilldetail SET  quantitybefore = 58 WHERE buybilldetailid = 93 ;
UPDATE product SET productName = 'بريزه ', productDescription = '', productCatId = '4', productBuyPrice = '14.00', productSellAllPrice = '14.60', productSellUnitPrice = '14.60', productSellHalfPrice = '14.60', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00279',type ='0', expireDate = '0' , dailyentryId = '330',isService = '0',isOptic = '0',lastbuyprice = '14',lastbuyprice_withDiscount = '14',meanbuyprice = '14',meanbuyprice_withDiscount = '14' , productbuypricereal = '14.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.29' , buyhalf_precentage = '4.29' , buypart_precentage = '4.29',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='14',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='14',meanbuyprice_withTax='14',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='14',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '279';
UPDATE buybilldetail SET  lastbuyprice = 14 , meanbuyprice = 14, lastbuyprice_withDiscount = 14, meanbuyprice_withDiscount = 14
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where buybilldetailid = 93;
UPDATE productunit SET proUnitBuyPrice  = 14 * productnumber WHERE productid = 279;
UPDATE storedetail SET  productquantity = '208', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '150', '0', '26', 'اضافة فاتورة مشتريات', 'buyBillController.php', '58', '208', '1', '2026-09-26 12:06:53','0','0'); -- id=1913
UPDATE supplier SET  suppliercurrentDebt = '42113.5',suppliercurrentDebtInCurrency= '42113.5' , userid = '1', supplierdate = '2026-09-26 12:08:15'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '42113.50', '0', '0', 'اضافة فاتورة مشتريات', '26', '42113.5', '2026-09-26 12:06:53', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','42113.5','0','42113.5','0',''); -- id=52
UPDATE save SET  savecurrentvalue = '-330813.88',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-326643.88','4170', '1', '1', 'اضافة فاتورة مشتريات', '26', '-330813.88', '2026-09-26 12:06:53', '1',  'buyBillController.php','0','','0'); -- id=134
update buybill set dailyentryid='0,0' where buybillid=26;
COMMIT;
UPDATE product SET overAllAveragePrice = 14 WHERE productId = 279;UPDATE product SET overAllAveragePrice = 13.8 WHERE productId = 280;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:38:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 12:08:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 12:08:18', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=26'); -- id=2430
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 08:38:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 12:08:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 12:08:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2431
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:21:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 13:51:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 13:51:34', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2432
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 ('مصطفي الغرباوي ' , '', '', '', '7650', '', '0', '2026-09-26 13:54:51', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-26','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=38
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('38', '0', '0', '', ''); -- id=38
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 ('38','0','7650','0','إضافة عميل جديد','38', '7650', '2026-09-26 13:54:51', '1', 'clientController.php', '', '7650', '0', null, '0', null, null,'', '0','1','1','7650','1','','0','0','',''); -- id=216
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('مصطفي الغرباوي ', 'مصطفي الغرباوي ', 'مصطفي الغرباوي ', 'مصطفي الغرباوي ', '58', '0', '0', '0', '', '1', '1', '', '0', '3', '1', '', '1', '0', '2026-09-26 13:54:52'); -- id=470
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7650', '7650', '2026-09-26', '1', '0', '0', '2026-09-26 13:54:52','تم اضافة عميل مصطفي الغرباوي ','1','0','0','0','38','clientController.php?do=edit&id=38'); -- id=954
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('954', '470', '7650', '','0'); -- id=954
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '7650', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('954', '121', '7650', '','0'); -- id=954
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1522341.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
COMMIT;
UPDATE client SET clientname = 'مصطفي الغرباوي ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '7650.00', clientdetails = '', conditions = '0', clientdate = '2026-09-26', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '954' , 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='470',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 = '38';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:31:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:01:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:01:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2433
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:31:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:01:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:01:38', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2434
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:31:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:01:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:01:46', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2435
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:31:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:01:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:01:51', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=97'); -- id=2436
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:32:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:02:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:02:10', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2437
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:32:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:02:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:02:48', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2438

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7b443195cb
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(24,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 14:02:48', '06ab7b443195cb', '24', '4271.00', '4271', '0', '1', '1900.00', '1900', '1900', '0', '1', '2026-09-26 14:02:48', '', '1', '0', 'وليد الهنداوي', '1', '1', '3', '0', '24 - وليد الهنداوي', '5' ,'0','','','','','-1','0','0','0','0','0','1900','0','','0','0','1900','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=131
UPDATE client SET  clientdebt = '4271', userid = '1' WHERE clientid = '24';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('24','4271.00','0','0','اضافة فاتورة مبيعات','131', '4271', '2026-09-26 14:02:49', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1900', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 14:02:48','0','0','',''); -- id=217
UPDATE client SET  inUse = 0 where clientid = 24;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 45;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('332','00070', '131', '12', '70', '5', '380', '1900', '0', '', '1', '2026-09-26 14:02:49', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','45-5,','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=924
UPDATE sellbilldetail SET  lastbuyprice = 332.00 , meanbuyprice = 321.76, lastbuyprice_withDiscount = 332.00, meanbuyprice_withDiscount = 321.76
        , lastbuyprice_withTax = 332, meanbuyprice_withTax = 321.76, lastbuyprice_withDiscountAndTax = 332
                where sellbilldetailid = 924;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (70, '2026-09-26', 1900, 1660, 1660
                    , 1608.8, 1660, 1608.8, 1660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1660, 1608.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1608.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1608.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1608.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+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1900, 1660, 1660
                    , 1608.8, 1660, 1608.8, 1660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1660, 1608.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1608.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1608.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1608.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 = '62', userid = '1', storedetaildate = '2026-09-26 14:02:49' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '5', '1', '131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '67', '62', '1', '2026-09-26 14:02:49','0','0'); -- id=1914
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-328913.875',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-330813.875','1900', '0', '1', 'اضافة فاتورة مبيعات', '131', '-328913.875', '2026-09-26 14:02:49', '1',  'sellbillController.php','24','','0'); -- id=135
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1900', '1900', '2026-09-26', '1', '0', '0', '2026-09-26 14:02:50','اضافة فاتورة مبيعات رقم 131','1','0',null,'0','131','sellbillController.php?do=showDetail&sellbillid=131'); -- id=955
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('955', '453', '1900', '','0'); -- id=955
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '6171', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('955', '143', '1900', '','0'); -- id=955
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '443936.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1900', '1900', '2026-09-26', '1', '0', '0', '2026-09-26 14:02:50','اضافة فاتورة مبيعات رقم 131 - تحصيل الفاتورة من العميل','1','0',null,'0','131','sellbillController.php?do=showDetail&sellbillid=131'); -- id=956
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('956', '383', '1900', '','0'); -- id=956
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-276116.85', 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 ('956', '453', '1900', '','0'); -- id=956
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '4271', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1660', '1660', '2026-09-26', '1', '0', '0', '2026-09-26 14:02:50','اضافة فاتورة مبيعات رقم 131 - صرف البضاعة من المخزن','1','0',null,'0','131','sellbillController.php?do=showDetail&sellbillid=131'); -- id=957
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('957', '402', '1660', '','0'); -- id=957
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '412801.43', 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 ('957', '382', '1660', '','0'); -- id=957
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2427986.04', 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='955,956,957' where sellbillid=131;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 1900, 1660, 1660
                    , 1608.8, 1660, 1608.8, 1660
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1660, 1608.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1608.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1608.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1608.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (24, '2026-09-26', 1900, 1660, 1660
                    , 1608.8, 1660, 1608.8, 1660
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1660, 1608.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1608.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1608.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1608.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1900, 1660, 1660
                    , 1608.8, 1660, 1608.8, 1660, 1660, 1608.8)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1900, netSellCostBuyPrice = netSellCostBuyPrice+1660
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1660
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1608.8
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1660
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1608.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1660
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1660
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1608.8;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7b443195cb and sellbillId = 131 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:32:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:02:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:02:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2439
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:33:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:03:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:03:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2440
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:33:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:03:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:03:40', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2441

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7b476463ac
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(24,@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-09-26 14:03:40', '06ab7b476463ac', '24', '4271.00', '2521', '0', '1', '1750', '1750', '0', '-1750', '1', '2026-09-26 14:03:40', '', '1', '0', 'وليد الهنداوي','1', '1', '5', '0', '24 - وليد الهنداوي', '1', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=7
UPDATE client SET  clientdebt = '2521', userid = '1' WHERE clientid = '24';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('24','4271.00','1750','1','اضافة فاتورة مردوات مبيعات','7', '2521', '2026-09-26 14:03:41', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1750', '0', null, '0', null, null,'', '0','1','1','1750','1','2026-09-26 14:03:40','0','0','',''); -- id=218
UPDATE client SET  inUse = 0 where clientid = 24;
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 ('1587.00', '00241', '7', '10', '241', '1', '1750', '1750', '0', '', '0', '0', '241', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','1750','1750','0','','0'); -- id=20
UPDATE returnsellbilldetail SET  lastbuyprice = 1587.00 , meanbuyprice = 1587.00, lastbuyprice_withDiscount = 1587.00, meanbuyprice_withDiscount = 1587.00
        , lastbuyprice_withTax = 1587, meanbuyprice_withTax = 1587, lastbuyprice_withDiscountAndTax = 1587
                where returnsellbilldetailid = 20;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (241, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1750, 1587, 1587, 1587
                    , 1587, 1587, 1587, 0, 1, 0, 0, 1587, 1587)
                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+1750, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1750, 1587, 1587, 1587
                    , 1587, 1587, 1587, 0, 0, 1587, 1587)
                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+1750, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-26 14:03:41' WHERE storedetailid = '241';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('241', '1', '1', '0', '7', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1', '2', '1', '2026-09-26 14:03:41','0','0'); -- id=1915
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1750', '1750', '2026-09-26', '1', '0', '0', '2026-09-26 14:03:41','اضافة فاتورة مردود مبيعات رقم 7','1','0',null,'0','7','returnsellbillController.php?do=showDetail&returnsellbillid=7'); -- id=958
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('958', '143', '1750', '','0'); -- id=958
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '442186.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('958', '453', '1750', '','0'); -- id=958
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '2521', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1587', '1587', '2026-09-26', '1', '0', '0', '2026-09-26 14:03:41','اضافة فاتورة مردود مبيعات رقم 7 - صرف البضاعة من المخزن','1','0',null,'0','7','returnsellbillController.php?do=showDetail&returnsellbillid=7'); -- id=959
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('959', '382', '1587', '','0'); -- id=959
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2429573.04', 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 ('959', '402', '1587', '','0'); -- id=959
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '411214.43', 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='958,0,959' where returnsellbillid=7;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1750, 1587, 1587, 1587
                    , 1587, 1587, 1587 ,0, 0, 1587, 1587)
                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+1750, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (24, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1750, 1587, 1587, 1587
                    , 1587, 1587, 1587 ,0, 0, 1587, 1587)
                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+1750, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1750, -1587, -1587
                    , -1587, -1587, -1587, -1587, -1587, -1587)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1750, netSellCostBuyPrice = netSellCostBuyPrice+-1587
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1587
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1587
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1587
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1587
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1587
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1587
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1587;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7b476463ac and sellbillId = 7 and returnsellbillId = 7
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:33:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:03:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:03:44', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2442
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:34:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:04:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:04:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2443
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:43:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:13:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 14:13:10', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2444
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:44:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:14:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 14:14:04', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2445
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لمبه 200 وات ايفر ','','2','29.5','30','30','30','2026-09-26','0','1','0','','0','0','0','0','0','29.5','29.5','29.5','29.5','29.5','0','1.69','1.69','1.69','.','0','0','0','29.5','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','29.5','29.5','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','29.5','0','0','0','0','0','0','','','0','0','0','0'); -- id=521
UPDATE product SET productName = 'لمبه 200 وات ايفر ', productDescription = '', productCatId = '2', productBuyPrice = '29.5', productSellAllPrice = '30', productSellUnitPrice = '30', productSellHalfPrice = '30', productDate = '2026-09-26', conditions = '0', userId = '1', limitamount = '0', parcode = '00521',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '29.5',lastbuyprice_withDiscount = '29.5',meanbuyprice = '29.5',meanbuyprice_withDiscount = '29.5' , productbuypricereal = '29.5' , buypricereal_precentage = '0' , buytotal_precentage = '1.69' , buyhalf_precentage = '1.69' , buypart_precentage = '1.69',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='29.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='29.5',meanbuyprice_withTax='29.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='29.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '521';
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', '521', '1.00', '2026-09-26', '1', '0','0052101','30','30','30','29.5','','0','0','0','0','0','0','0','0','0','0'); -- id=521
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('521', '1', '48', '1', '2026-09-26'); -- id=521
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('521', '1', '48', '0', '521', 'إضافة منتج', 'productController.php', '0', '48', '1', '2026-09-26','0','0'); -- id=1916
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (521, 1,'2026-09-26 14:14:05',1)
                ON DUPLICATE KEY UPDATE productid = 521, edited = 1, sysdate = '2026-09-26 14:14:05', userid = 1; -- id=648
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1416', '1416', '2026-09-26', '1', '0', '0', '2026-09-26 14:14:05','إضافة منتج لمبه 200 وات ايفر  الكمية 48','1','0','0','0','521','productController.php?do=edit&id=521'); -- id=960
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('960', '382', '1416', '','0'); -- id=960
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2430989.04', 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 ('960', '121', '1416', '','0'); -- id=960
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1523757.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه 200 وات ايفر ', productDescription = '', productCatId = '2', productBuyPrice = '29.50', productSellAllPrice = '30.00', productSellUnitPrice = '30.00', productSellHalfPrice = '30.00', productDate = '2026-09-26', conditions = '0', userId = '1', limitamount = '0', parcode = '00521',type ='0', expireDate = '0' , dailyentryId = '960',isService = '0',isOptic = '0',lastbuyprice = '29.5',lastbuyprice_withDiscount = '29.5',meanbuyprice = '29.5',meanbuyprice_withDiscount = '29.5' , productbuypricereal = '29.5' , buypricereal_precentage = '0' , buytotal_precentage = '1.69' , buyhalf_precentage = '1.69' , buypart_precentage = '1.69',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='29.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='29.5',meanbuyprice_withTax='29.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='29.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '521';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:44:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:14:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-26 14:14:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2446
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:15:10', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2447

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7b1c6b4ea7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 14:15:11', '06ab7b1c6b4ea7', '38', '7650.00', '12152', '0', '1', '4502.00', '4502', '0', '4502', '1', '2026-09-26 14:15:11', '', '1', '0', 'مصطفي الغرباوي ', '1', '1', '3', '0', 'مصطفي الغرباوي ', '375' ,'0','','','','','-1','0','0','0','0','0','4502','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=132
UPDATE client SET  clientdebt = '12152', userid = '1' WHERE clientid = '38';
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 ('38','7650.00','4502','0','اضافة فاتورة مبيعات','132', '12152', '2026-09-26 14:15:12', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4502', '0', null, '0', null, null,'', '0','1','1','4502','1','2026-09-26 14:15:11','0','0','',''); -- id=219
UPDATE client SET  inUse = 0 where clientid = 38;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6.5','00315', '132', '6', '315', '48', '8', '384', '0', '', '1', '2026-09-26 14:15:12', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','384','0','','0','0.00','0','0','0','0'); -- id=925
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 925;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-09-26', 384, 312, 312
                    , 312, 312, 312, 312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 48, 0, 312, 312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+48
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 384, 312, 312
                    , 312, 312, 312, 312
                    , 0, 0, 0, 0
                    , 0, 0, 0, 312, 312, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+312
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+312, sellCostMeanBuyPrice = sellCostMeanBuyPrice+312
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+312
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+312
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+312
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-26 14:15:12' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '48', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '755', '707', '1', '2026-09-26 14:15:12','0','0'); -- id=1917
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 15;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('24.8','00291', '132', '24', '291', '24', '28', '672', '0', '', '1', '2026-09-26 14:15:12', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','15-5,','1','1','0','0','28','672','0','','0','0.00','0','0','0','0'); -- id=926
UPDATE sellbilldetail SET  lastbuyprice = 24.80 , meanbuyprice = 24.80, lastbuyprice_withDiscount = 24.80, meanbuyprice_withDiscount = 24.80
        , lastbuyprice_withTax = 24.8, meanbuyprice_withTax = 24.8, lastbuyprice_withDiscountAndTax = 24.8
                where sellbilldetailid = 926;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (291, '2026-09-26', 672, 595.2, 595.2
                    , 595.2, 595.2, 595.2, 595.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 595.2, 595.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+672, sellCostBuyPrice =sellCostBuyPrice+595.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+595.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+595.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+595.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+595.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+595.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+595.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+595.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 672, 595.2, 595.2
                    , 595.2, 595.2, 595.2, 595.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 595.2, 595.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+672, sellCostBuyPrice =sellCostBuyPrice+595.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+595.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+595.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+595.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+595.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+595.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+595.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+595.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '59', userid = '1', storedetaildate = '2026-09-26 14:15:12' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '24', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '83', '59', '1', '2026-09-26 14:15:13','0','0'); -- id=1918
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('645','00219', '132', '13', '219', '1', '690', '690', '0', '', '1', '2026-09-26 14:15:13', '219', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','690','690','0','','0','0.00','0','0','0','0'); -- id=927
UPDATE sellbilldetail SET  lastbuyprice = 645.00 , meanbuyprice = 645.00, lastbuyprice_withDiscount = 645.00, meanbuyprice_withDiscount = 645.00
        , lastbuyprice_withTax = 645, meanbuyprice_withTax = 645, lastbuyprice_withDiscountAndTax = 645
                where sellbilldetailid = 927;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (219, '2026-09-26', 690, 645, 645
                    , 645, 645, 645, 645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 645, 645, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+690, sellCostBuyPrice =sellCostBuyPrice+645
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 690, 645, 645
                    , 645, 645, 645, 645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 645, 645, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+690, sellCostBuyPrice =sellCostBuyPrice+645
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-26 14:15:13' WHERE storedetailid = '219';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('219', '1', '1', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-09-26 14:15:13','0','0'); -- id=1919
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.2','00195', '132', '20', '195', '20', '16', '320', '0', '', '1', '2026-09-26 14:15:13', '195', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','16','320','0','','0','0.00','0','0','0','0'); -- id=928
UPDATE sellbilldetail SET  lastbuyprice = 14.20 , meanbuyprice = 14.20, lastbuyprice_withDiscount = 14.20, meanbuyprice_withDiscount = 14.20
        , lastbuyprice_withTax = 14.2, meanbuyprice_withTax = 14.2, lastbuyprice_withDiscountAndTax = 14.2
                where sellbilldetailid = 928;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (195, '2026-09-26', 320, 284, 284
                    , 284, 284, 284, 284
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 284, 284, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+320, sellCostBuyPrice =sellCostBuyPrice+284
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+284, sellCostMeanBuyPrice = sellCostMeanBuyPrice+284
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+284, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+284
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+284
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+284
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+284
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 320, 284, 284
                    , 284, 284, 284, 284
                    , 0, 0, 0, 0
                    , 0, 0, 0, 284, 284, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+320, sellCostBuyPrice =sellCostBuyPrice+284
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+284, sellCostMeanBuyPrice = sellCostMeanBuyPrice+284
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+284, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+284
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+284
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+284
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+284
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2026-09-26 14:15:13' WHERE storedetailid = '195';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('195', '1', '20', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '136', '116', '1', '2026-09-26 14:15:13','0','0'); -- id=1920
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00089', '132', '12', '89', '240', '4.9', '1176', '0', '', '1', '2026-09-26 14:15:13', '89', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4.9','1176','0','','0','0.00','0','0','0','0'); -- id=929
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.25, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.25
        , lastbuyprice_withTax = 4.25, meanbuyprice_withTax = 4.25, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 929;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (89, '2026-09-26', 1176, 1080, 960
                    , 1020, 960, 1020, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 240, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1176, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1020
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+240
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1176, 1080, 960
                    , 1020, 960, 1020, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1176, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1020
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '200', userid = '1', storedetaildate = '2026-09-26 14:15:14' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '240', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '440', '200', '1', '2026-09-26 14:15:14','0','0'); -- id=1921
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16','00239', '132', '2', '239', '20', '18', '360', '0', '', '1', '2026-09-26 14:15:14', '239', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','18','360','0','','0','0.00','0','0','0','0'); -- id=930
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 930;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (239, '2026-09-26', 360, 320, 320
                    , 320, 320, 320, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 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 = '178', userid = '1', storedetaildate = '2026-09-26 14:15:14' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '20', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '198', '178', '1', '2026-09-26 14:15:14','0','0'); -- id=1922
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00521', '132', '2', '521', '20', '30', '600', '0', '', '1', '2026-09-26 14:15:14', '521', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30','600','0','','0','0.00','0','0','0','0'); -- id=931
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 931;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (521, '2026-09-26', 600, 590, 590
                    , 590, 590, 590, 590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 590, 590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 600, 590, 590
                    , 590, 590, 590, 590
                    , 0, 0, 0, 0
                    , 0, 0, 0, 590, 590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+590, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+590
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+590
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-26 14:15:14' WHERE storedetailid = '521';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('521', '1', '20', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '28', '1', '2026-09-26 14:15:14','0','0'); -- id=1923
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('140','00221', '132', '13', '221', '2', '150', '300', '0', '', '1', '2026-09-26 14:15:14', '221', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=932
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 932;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (221, '2026-09-26', 300, 280, 280
                    , 280, 280, 280, 280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 280, 280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 300, 280, 280
                    , 280, 280, 280, 280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 280, 280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-09-26 14:15:15' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '2', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '13', '1', '2026-09-26 14:15:15','0','0'); -- id=1924
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4502', '4502', '2026-09-26', '1', '0', '0', '2026-09-26 14:15:15','اضافة فاتورة مبيعات رقم 132','1','0',null,'0','132','sellbillController.php?do=showDetail&sellbillid=132'); -- id=961
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('961', '470', '4502', '','0'); -- id=961
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '12152', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('961', '143', '4502', '','0'); -- id=961
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '446688.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3986.2', '3986.2', '2026-09-26', '1', '0', '0', '2026-09-26 14:15:15','اضافة فاتورة مبيعات رقم 132 - صرف البضاعة من المخزن','1','0',null,'0','132','sellbillController.php?do=showDetail&sellbillid=132'); -- id=962
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('962', '402', '3986.2', '','0'); -- id=962
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '415200.63', 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 ('962', '382', '3986.2', '','0'); -- id=962
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2427002.84', 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='961,0,962' where sellbillid=132;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 4502, 4106.2, 3986.2
                    , 4046.2, 3986.2, 4046.2, 3986.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4046.2, 4046.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4502, sellCostBuyPrice =sellCostBuyPrice+4106.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3986.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4046.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3986.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4046.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3986.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4046.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4046.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (38, '2026-09-26', 4502, 4106.2, 3986.2
                    , 4046.2, 3986.2, 4046.2, 3986.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4046.2, 4046.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4502, sellCostBuyPrice =sellCostBuyPrice+4106.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3986.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4046.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3986.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4046.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3986.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4046.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4046.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 4502, 4106.2, 3986.2
                    , 4046.2, 3986.2, 4046.2, 3986.2, 4046.2, 4046.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4502, netSellCostBuyPrice = netSellCostBuyPrice+4106.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3986.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4046.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3986.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4046.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3986.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4046.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4046.2;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7b1c6b4ea7 and sellbillId = 132 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 14:15:16', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2448
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 14:15:24', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2449
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 14:15:49', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2450

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =220
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '2152' , clientdate = '2026-09-26 14:15:49', userid = '1' WHERE clientid = '38';
UPDATE client SET  inUse = 0 where clientid = 38;
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 ('38','12152.00','10000','1','ايصال تحصيل (( قبض من عميل ))','220', '2152', '2026-09-26 14:15:24', '1', 'clientPayedDeptController.php', '   ', '10000', '0', null, '0', null, null,'', '-1','1','1','10000','1','','15','0','','.'); -- id=220
UPDATE save SET  savecurrentvalue = '-318913.88',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-328913.88','10000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '220', '-318913.88', '2026-09-26 14:15:49', '1',  'clientPayedDeptController.php','38','','0'); -- id=136
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-09-26', '1', '0', '0', '2026-09-26 14:15:49','اضافة ايصال سداد للعميل مصطفي الغرباوي ','1','0','0','0','220','clientPayedDeptController.php?do=show&id=220'); -- id=963
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('963', '383', '10000', '','0'); -- id=963
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-266116.85', 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 ('963', '470', '10000', '','0'); -- id=963
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '2152', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
UPDATE clientdebtchange SET clientid = '38', clientdebtchangebefore = '12152.000', clientdebtchangeamount = '10000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '220', clientdebtchangeafter = '2152.000', clientdebtchangedate = '2026-09-26 14:15:24', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '10000.000',discount='', reciptid='0', dailyentryid = '963',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '220';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 14:15:51', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2451
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 10:45:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 14:15:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 14:15:52', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2452
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 12:02:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 15:32:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 15:32:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2453
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 13:14:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 16:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 16:44:58', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2454

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7c98f89f45
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:44:59', '06ab7c98f89f45', '1', '0.00', '0', '0', '1', '5526.00', '5526', '5526', '0', '1', '2026-09-26 16:44:59', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '48' ,'0','','','','','-1','0','0','0','0','0','5526','0','','0','0','5526','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','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=133
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','اضافة فاتورة مبيعات','133', '0', '2026-09-26 16:44:59', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5526', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 16:44:59','0','0','',''); -- 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 ('24.8','00291', '133', '24', '291', '20', '25.8', '516', '0', '', '0', '2026-09-26 16:44:59', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','25.8','516','0','','0','','0','0','0','0'); -- id=933
UPDATE sellbilldetail SET  lastbuyprice = 24.80 , meanbuyprice = 24.80, lastbuyprice_withDiscount = 24.80, meanbuyprice_withDiscount = 24.80
        , lastbuyprice_withTax = 24.8, meanbuyprice_withTax = 24.8, lastbuyprice_withDiscountAndTax = 24.8
                where sellbilldetailid = 933;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (291, '2026-09-26', 516, 496, 496
                    , 496, 496, 496, 496
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 496, 496, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+516, sellCostBuyPrice =sellCostBuyPrice+496
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+496, sellCostMeanBuyPrice = sellCostMeanBuyPrice+496
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+496, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+496
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+496
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+496
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+496
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 516, 496, 496
                    , 496, 496, 496, 496
                    , 0, 0, 0, 0
                    , 0, 0, 0, 496, 496, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+516, sellCostBuyPrice =sellCostBuyPrice+496
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+496, sellCostMeanBuyPrice = sellCostMeanBuyPrice+496
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+496, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+496
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+496
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+496
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+496
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-09-26 16:45:00' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '20', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59', '39', '1', '2026-09-26 16:45:00','0','0'); -- id=1925
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','00262', '133', '10', '262', '1', '635', '635', '0', '', '0', '2026-09-26 16:45:00', '262', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','635','635','0','','0','','0','0','0','0'); -- id=934
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 934;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (262, '2026-09-26', 635, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+635, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 635, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+635, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-26 16:45:00' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '1', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-09-26 16:45:00','0','0'); -- id=1926
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 89;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('85.97','00115', '133', '3', '115', '10', '90.5', '905', '0', '', '0', '2026-09-26 16:45:00', '115', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','89-10,','1','1','0','0','90.5','905','0','','0','0.00','0','0','0','0'); -- id=935
UPDATE sellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where sellbilldetailid = 935;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (115, '2026-09-26', 905, 859.7, 859.7
                    , 872.9, 859.7, 872.9, 859.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 859.7, 872.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+905, sellCostBuyPrice =sellCostBuyPrice+859.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+859.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+872.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+859.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+872.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+859.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+859.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+872.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 905, 859.7, 859.7
                    , 872.9, 859.7, 872.9, 859.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 859.7, 872.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+905, sellCostBuyPrice =sellCostBuyPrice+859.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+859.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+872.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+859.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+872.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+859.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+859.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+872.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2026-09-26 16:45:00' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '10', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '47', '1', '2026-09-26 16:45:00','0','0'); -- id=1927
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.77','00347', '133', '3', '347', '10', '31', '310', '0', '', '0', '2026-09-26 16:45:00', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','21-10,','1','1','0','0','31','310','0','','0','0.00','0','0','0','0'); -- id=936
UPDATE sellbilldetail SET  lastbuyprice = 29.45 , meanbuyprice = 29.64, lastbuyprice_withDiscount = 29.45, meanbuyprice_withDiscount = 29.64
        , lastbuyprice_withTax = 29.45, meanbuyprice_withTax = 29.64, lastbuyprice_withDiscountAndTax = 29.45
                where sellbilldetailid = 936;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (347, '2026-09-26', 310, 294.5, 294.5
                    , 296.4, 294.5, 296.4, 296.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 294.5, 296.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+310, sellCostBuyPrice =sellCostBuyPrice+294.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+294.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+296.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+294.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+296.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+296.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+294.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+296.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+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 310, 294.5, 294.5
                    , 296.4, 294.5, 296.4, 296.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 294.5, 296.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+310, sellCostBuyPrice =sellCostBuyPrice+294.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+294.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+296.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+294.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+296.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+296.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+294.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+296.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 = '39', userid = '1', storedetaildate = '2026-09-26 16:45:01' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '10', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '39', '1', '2026-09-26 16:45:01','0','0'); -- id=1928
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('735','00209', '133', '10', '209', '2', '755', '1510', '0', '', '0', '2026-09-26 16:45:01', '209', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','755','1510','0','','0','0.00','0','0','0','0'); -- id=937
UPDATE sellbilldetail SET  lastbuyprice = 735.00 , meanbuyprice = 735.00, lastbuyprice_withDiscount = 735.00, meanbuyprice_withDiscount = 735.00
        , lastbuyprice_withTax = 735, meanbuyprice_withTax = 735, lastbuyprice_withDiscountAndTax = 735
                where sellbilldetailid = 937;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (209, '2026-09-26', 1510, 1470, 1470
                    , 1470, 1470, 1470, 1470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1510, 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
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1510, 1470, 1470
                    , 1470, 1470, 1470, 1470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1510, 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;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-09-26 16:45:01' WHERE storedetailid = '209';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '1', '2', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '4', '1', '2026-09-26 16:45:01','0','0'); -- id=1929
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '133', '19', '175', '5', '330', '1650', '0', '', '0', '2026-09-26 16:45:01', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','330','1650','0','','0','0.00','0','0','0','0'); -- id=938
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 = 938;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-09-26', 1650, 1625, 1625
                    , 1625, 1625, 1625, 1625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1625, 1625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1650, 1625, 1625
                    , 1625, 1625, 1625, 1625
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1625, 1625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1625
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1625, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1625, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1625
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-26 16:45:02' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '5', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '34', '1', '2026-09-26 16:45:02','0','0'); -- id=1930
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-313387.875',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-318913.875','5526', '0', '1', 'اضافة فاتورة مبيعات', '133', '-313387.875', '2026-09-26 16:45:02', '1',  'sellbillController.php','1','','0'); -- id=137
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5526', '5526', '2026-09-26', '1', '0', '0', '2026-09-26 16:45:02','اضافة فاتورة مبيعات رقم 133','1','0',null,'0','133','sellbillController.php?do=showDetail&sellbillid=133'); -- id=964
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('964', '383', '5526', '','0'); -- id=964
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-260590.85', 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 ('964', '143', '5526', '','0'); -- id=964
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '452214.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5325.2', '5325.2', '2026-09-26', '1', '0', '0', '2026-09-26 16:45:02','اضافة فاتورة مبيعات رقم 133 - صرف البضاعة من المخزن','1','0',null,'0','133','sellbillController.php?do=showDetail&sellbillid=133'); -- id=965
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('965', '402', '5325.2', '','0'); -- id=965
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '420525.83', 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 ('965', '382', '5325.2', '','0'); -- id=965
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2421677.64', 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='964,0,965' where sellbillid=133;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 5526, 5325.2, 5325.2
                    , 5340.3, 5325.2, 5340.3, 5327.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5325.2, 5340.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5526, sellCostBuyPrice =sellCostBuyPrice+5325.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5325.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5340.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5325.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5340.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5327.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5325.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5340.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 5526, 5325.2, 5325.2
                    , 5340.3, 5325.2, 5340.3, 5327.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5325.2, 5340.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5526, sellCostBuyPrice =sellCostBuyPrice+5325.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5325.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5340.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5325.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5340.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5327.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5325.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5340.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5526, 5325.2, 5325.2
                    , 5340.3, 5325.2, 5340.3, 5327.3, 5325.2, 5340.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5526, netSellCostBuyPrice = netSellCostBuyPrice+5325.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5325.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5340.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5325.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5340.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5327.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5325.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5340.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7c98f89f45 and sellbillId = 133 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 13:15:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 16:45:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 16:45:03', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2455
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 13:25:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 16:55:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 16:55:00', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2456

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7da708e886
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7da708e886 and sellbillId = 134 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 13:25:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 16:55:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 16:55:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2457
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:31:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:01:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:01:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2458
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:31:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:01:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:01:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:02:21', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2460

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7ec71c9e15
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@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-09-26 18:02:21', '06ab7ec71c9e15', '38', '2152.00', '702', '0', '1', '1450', '1450', '0', '-1450', '1', '2026-09-26 18:02:21', '', '1', '0', 'مصطفي الغرباوي ','1', '1', '5', '0', 'مصطفي الغرباوي ', '1', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=8
UPDATE client SET  clientdebt = '702', userid = '1' WHERE clientid = '38';
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 ('38','2152.00','1450','1','اضافة فاتورة مردوات مبيعات','8', '702', '2026-09-26 18:02:22', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1450', '0', null, '0', null, null,'', '0','1','1','1450','1','2026-09-26 18:02:21','0','0','',''); -- id=223
UPDATE client SET  inUse = 0 where clientid = 38;
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 ('1587.00', '00241', '8', '10', '241', '1', '1450', '1450', '0', '', '1', '0', '241', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','1450','1450','0','','0'); -- id=21
UPDATE returnsellbilldetail SET  lastbuyprice = 1587.00 , meanbuyprice = 1587.00, lastbuyprice_withDiscount = 1587.00, meanbuyprice_withDiscount = 1587.00
        , lastbuyprice_withTax = 1587, meanbuyprice_withTax = 1587, lastbuyprice_withDiscountAndTax = 1587
                where returnsellbilldetailid = 21;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (241, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1450, 1587, 1587, 1587
                    , 1587, 1587, 1587, 0, 1, 0, 0, 1587, 1587)
                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+1450, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1450, 1587, 1587, 1587
                    , 1587, 1587, 1587, 0, 0, 1587, 1587)
                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+1450, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-26 18:02:22' WHERE storedetailid = '241';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('241', '1', '1', '0', '8', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '2', '3', '1', '2026-09-26 18:02:22','0','0'); -- id=1934
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1450', '1450', '2026-09-26', '1', '0', '0', '2026-09-26 18:02:22','اضافة فاتورة مردود مبيعات رقم 8','1','0',null,'0','8','returnsellbillController.php?do=showDetail&returnsellbillid=8'); -- id=968
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('968', '143', '1450', '','0'); -- id=968
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '457654.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('968', '470', '1450', '','0'); -- id=968
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '702', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1587', '1587', '2026-09-26', '1', '0', '0', '2026-09-26 18:02:22','اضافة فاتورة مردود مبيعات رقم 8 - صرف البضاعة من المخزن','1','0',null,'0','8','returnsellbillController.php?do=showDetail&returnsellbillid=8'); -- id=969
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('969', '382', '1587', '','0'); -- id=969
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2417426.34', 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 ('969', '402', '1587', '','0'); -- id=969
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '424777.13', 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='968,0,969' where returnsellbillid=8;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1450, 1587, 1587, 1587
                    , 1587, 1587, 1587 ,0, 0, 1587, 1587)
                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+1450, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (38, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1450, 1587, 1587, 1587
                    , 1587, 1587, 1587 ,0, 0, 1587, 1587)
                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+1450, returnSellCostBuyPrice = returnSellCostBuyPrice+1587, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1587
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1587, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1587
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1587
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1587
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1587
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1587;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1450, -1587, -1587
                    , -1587, -1587, -1587, -1587, -1587, -1587)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1450, netSellCostBuyPrice = netSellCostBuyPrice+-1587
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1587
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1587
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1587
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1587
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1587
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1587
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1587;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7ec71c9e15 and sellbillId = 8 and returnsellbillId = 8
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:02:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2461
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:02:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2462
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:02:47', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2463
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:02:48', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2464
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:32:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:02:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:02:59', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:33:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:03:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:03:12', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2466

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =224
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-09-26 18:03:13', 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','2422.88','2422.88','1','ايصال تحصيل (( قبض من عميل ))','224', '0', '2026-09-26 18:02:59', '1', 'clientPayedDeptController.php', '   ', '2422.88', '0', null, '0', null, null,'', '-1','1','1','2422.88','1','','16','0','','.'); -- id=224
UPDATE save SET  savecurrentvalue = '-310965',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-313387.88','2422.88', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '224', '-310965', '2026-09-26 18:03:13', '1',  'clientPayedDeptController.php','2','','0'); -- id=138
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2422.88', '2422.88', '2026-09-26', '1', '0', '0', '2026-09-26 18:03:13','اضافة ايصال سداد للعميل فؤاد الطوخي','1','0','0','0','224','clientPayedDeptController.php?do=show&id=224'); -- id=970
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('970', '383', '2422.88', '','0'); -- id=970
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-258167.97', 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 ('970', '426', '2422.88', '','0'); -- id=970
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 = '2422.880', clientdebtchangeamount = '2422.880', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '224', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-09-26 18:02:59', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2422.880',discount='', reciptid='0', dailyentryid = '970',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='2422.88',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '224';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:33:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:03:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:03:14', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:33:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:03:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:03:16', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2468
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:33:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:03:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:03:42', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2469
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:33:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:03:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:03:59', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2470

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =225
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(7,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '840' , clientdate = '2026-09-26 18:04:00', userid = '1' WHERE clientid = '7';
UPDATE client SET  inUse = 0 where clientid = 7;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('7','7540.00','6700','1','ايصال تحصيل (( قبض من عميل ))','225', '840', '2026-09-26 18:03:43', '1', 'clientPayedDeptController.php', '   ', '6700', '0', null, '0', null, null,'', '-1','1','1','6700','1','','17','0','','.'); -- id=225
UPDATE save SET  savecurrentvalue = '-304265',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-310965.00','6700', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '225', '-304265', '2026-09-26 18:04:00', '1',  'clientPayedDeptController.php','7','','0'); -- id=139
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6700', '6700', '2026-09-26', '1', '0', '0', '2026-09-26 18:04:00','اضافة ايصال سداد للعميل سامي الشربيني','1','0','0','0','225','clientPayedDeptController.php?do=show&id=225'); -- id=971
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('971', '383', '6700', '','0'); -- id=971
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-251467.97', 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 ('971', '434', '6700', '','0'); -- id=971
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '840', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
UPDATE clientdebtchange SET clientid = '7', clientdebtchangebefore = '7540.000', clientdebtchangeamount = '6700.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '225', clientdebtchangeafter = '840.000', clientdebtchangedate = '2026-09-26 18:03:43', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '6700.000',discount='', reciptid='0', dailyentryid = '971',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='6700',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '225';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:34:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:04:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:04:01', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2471
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:34:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:04:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:04:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2472
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:41:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:11:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 18:11:27', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2473
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:54:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:24:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:24:14', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:54:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:24:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:24:26', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2475

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab7f1af4d245
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 18:24:27', '06ab7f1af4d245', '1', '0.00', '0', '0', '1', '855.00', '855', '855', '0', '1', '2026-09-26 18:24:27', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','855','0','','0','0','855','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=135
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','اضافة فاتورة مبيعات','135', '0', '2026-09-26 18:24:27', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '855', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 18:24:27','0','0','',''); -- id=226
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00459', '135', '16', '459', '3', '285', '855', '0', '', '1', '2026-09-26 18:24:27', '459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','285','855','0','','0','0.00','0','0','0','0'); -- id=942
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 942;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (459, '2026-09-26', 855, 750, 750
                    , 750, 750, 750, 750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 750, 750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+855, sellCostBuyPrice =sellCostBuyPrice+750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 855, 750, 750
                    , 750, 750, 750, 750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 750, 750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+855, sellCostBuyPrice =sellCostBuyPrice+750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-09-26 18:24:28' WHERE storedetailid = '459';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('459', '1', '3', '1', '135', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '9', '1', '2026-09-26 18:24:28','0','0'); -- id=1935
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-303410',  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 ('-304265','855', '0', '1', 'اضافة فاتورة مبيعات', '135', '-303410', '2026-09-26 18:24:28', '1',  'sellbillController.php','1','','0'); -- id=140
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '855', '855', '2026-09-26', '1', '0', '0', '2026-09-26 18:24:28','اضافة فاتورة مبيعات رقم 135','1','0',null,'0','135','sellbillController.php?do=showDetail&sellbillid=135'); -- id=972
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('972', '383', '855', '','0'); -- id=972
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-250612.97', 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 ('972', '143', '855', '','0'); -- id=972
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458509.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '750', '750', '2026-09-26', '1', '0', '0', '2026-09-26 18:24:28','اضافة فاتورة مبيعات رقم 135 - صرف البضاعة من المخزن','1','0',null,'0','135','sellbillController.php?do=showDetail&sellbillid=135'); -- id=973
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('973', '402', '750', '','0'); -- id=973
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '425527.13', 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 ('973', '382', '750', '','0'); -- id=973
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2416676.34', 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='972,0,973' where sellbillid=135;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 855, 750, 750
                    , 750, 750, 750, 750
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,750, 750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+855, sellCostBuyPrice =sellCostBuyPrice+750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 855, 750, 750
                    , 750, 750, 750, 750
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,750, 750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+855, sellCostBuyPrice =sellCostBuyPrice+750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+750
                        , returnSellVal = returnSellVal+0, 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, 855, 750, 750
                    , 750, 750, 750, 750, 750, 750)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+855, netSellCostBuyPrice = netSellCostBuyPrice+750
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+750
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+750
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+750
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+750
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+750
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+750
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+750;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab7f1af4d245 and sellbillId = 135 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 14:54:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:24:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:24:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2476
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:08:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:38:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 18:38:30', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:11:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:41:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 18:41:12', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2478
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 ('06ab7f50705be5', '2026-09-26 18:38:31', '1', '42113.50', '42113.5', '0', '0', '41532.00',  '41532.00', '41532', '0', '1', '2026-09-26 18:41:12', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=27
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 ('00174', '27', '19', '174', '60', '270', '16200.00', '0', '', '2026-09-26 18:41:12', '174','','','0','0','0','0','0',null,'270','16200','0','0','0','0','0','0','0','0','1'); -- id=94
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 174, 0, 0
                    , 270, 60, 0, 0, 1, '2026-09-26 18:41:13')
                ON DUPLICATE KEY UPDATE buyprice = 270,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:13' ; -- id=94
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('174', '270', '60', '0', 'buyBillController.php', '94', '', '0', '0'); -- id=94
UPDATE product SET  productBuyPrice = "270" WHERE productId = 174 ;
UPDATE buybilldetail SET  quantitybefore = 7 WHERE buybilldetailid = 94 ;
UPDATE product SET productName = 'بلفونيره 30 وات خارج', productDescription = '', productCatId = '19', productBuyPrice = '270.00', productSellAllPrice = '275.00', productSellUnitPrice = '275.00', productSellHalfPrice = '275.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '5', parcode = '00174',type ='0', expireDate = '0' , dailyentryId = '201',isService = '0',isOptic = '0',lastbuyprice = '270',lastbuyprice_withDiscount = '270',meanbuyprice = '270',meanbuyprice_withDiscount = '270' , productbuypricereal = '270.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.85' , buyhalf_precentage = '1.85' , buypart_precentage = '1.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='270',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='270',meanbuyprice_withTax='270',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='270',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '174';
UPDATE buybilldetail SET  lastbuyprice = 270 , meanbuyprice = 270, lastbuyprice_withDiscount = 270, meanbuyprice_withDiscount = 270
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where buybilldetailid = 94;
UPDATE productunit SET proUnitBuyPrice  = 270 * productnumber WHERE productid = 174;
UPDATE storedetail SET  productquantity = '67', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('174', '1', '60', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '7', '67', '1', '2026-09-26 18:38:31','0','0'); -- id=1936
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 ('00175', '27', '19', '175', '40', '325', '13000.00', '0', '', '2026-09-26 18:41:12', '175','','','0','0','0','0','0',null,'325','13000','0','0','0','0','0','0','0','0','1'); -- id=95
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 175, 0, 0
                    , 325, 40, 0, 0, 1, '2026-09-26 18:41:14')
                ON DUPLICATE KEY UPDATE buyprice = 325,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:14' ; -- id=95
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('175', '325', '40', '0', 'buyBillController.php', '95', '', '0', '0'); -- id=95
UPDATE product SET  productBuyPrice = "325" WHERE productId = 175 ;
UPDATE buybilldetail SET  quantitybefore = 34 WHERE buybilldetailid = 95 ;
UPDATE product SET productName = 'بلفونيره 40 وات خارج ', productDescription = '', productCatId = '19', productBuyPrice = '325.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '10', parcode = '00175',type ='0', expireDate = '0' , dailyentryId = '202',isService = '0',isOptic = '0',lastbuyprice = '325',lastbuyprice_withDiscount = '325',meanbuyprice = '325',meanbuyprice_withDiscount = '325' , productbuypricereal = '325.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.54' , buyhalf_precentage = '1.54' , buypart_precentage = '1.54',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='325',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='325',meanbuyprice_withTax='325',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='325',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '175';
UPDATE buybilldetail SET  lastbuyprice = 325 , meanbuyprice = 325, lastbuyprice_withDiscount = 325, meanbuyprice_withDiscount = 325
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where buybilldetailid = 95;
UPDATE productunit SET proUnitBuyPrice  = 325 * productnumber WHERE productid = 175;
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '40', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '34', '74', '1', '2026-09-26 18:38:31','0','0'); -- id=1937
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', '27', '3', '100', '300', '17.6', '5280.00', '0', '', '2026-09-26 18:41:12', '100','','','0','0','0','0','0',null,'17.6','5280','0','0','0','0','0','0','0','0','1'); -- id=96
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 100, 0, 0
                    , 17.6, 300, 0, 0, 1, '2026-09-26 18:41:14')
                ON DUPLICATE KEY UPDATE buyprice = 17.6,
                        buyQuantity =buyQuantity+300, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:14' ; -- id=96
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('100', '17.6', '300', '0', 'buyBillController.php', '96', '', '0', '0'); -- id=96
UPDATE product SET  productBuyPrice = "17.6" WHERE productId = 100 ;
UPDATE buybilldetail SET  quantitybefore = 325 WHERE buybilldetailid = 96 ;
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 = 96;
UPDATE productunit SET proUnitBuyPrice  = 17.6 * productnumber WHERE productid = 100;
UPDATE storedetail SET  productquantity = '625', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '300', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '325', '625', '1', '2026-09-26 18:38:31','0','0'); -- id=1938
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', '27', '3', '101', '300', '17.6', '5280.00', '0', '', '2026-09-26 18:41:12', '101','','','0','0','0','0','0',null,'17.6','5280','0','0','0','0','0','0','0','0','1'); -- id=97
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 101, 0, 0
                    , 17.6, 300, 0, 0, 1, '2026-09-26 18:41:15')
                ON DUPLICATE KEY UPDATE buyprice = 17.6,
                        buyQuantity =buyQuantity+300, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:15' ; -- id=97
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('101', '17.6', '300', '0', 'buyBillController.php', '97', '', '0', '0'); -- id=97
UPDATE product SET  productBuyPrice = "17.6" WHERE productId = 101 ;
UPDATE buybilldetail SET  quantitybefore = 368 WHERE buybilldetailid = 97 ;
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 = 97;
UPDATE productunit SET proUnitBuyPrice  = 17.6 * productnumber WHERE productid = 101;
UPDATE storedetail SET  productquantity = '668', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '300', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '368', '668', '1', '2026-09-26 18:38:31','0','0'); -- id=1939
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00461', '27', '3', '461', '20', '39', '780.00', '0', '', '2026-09-26 18:41:12', '461','','','0','0','0','0','0',null,'39','780','0','0','0','0','0','0','0','0','1'); -- id=98
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 461, 0, 0
                    , 39, 20, 0, 0, 1, '2026-09-26 18:41:16')
                ON DUPLICATE KEY UPDATE buyprice = 39,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:16' ; -- id=98
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('461', '39', '20', '0', 'buyBillController.php', '98', '', '0', '0'); -- id=98
UPDATE product SET  productBuyPrice = "39" WHERE productId = 461 ;
UPDATE buybilldetail SET  quantitybefore = 10 WHERE buybilldetailid = 98 ;
UPDATE product SET productName = 'لقمه تلفون ', productDescription = '', productCatId = '3', productBuyPrice = '39.00', productSellAllPrice = '41.00', productSellUnitPrice = '41.00', productSellHalfPrice = '41.00', productDate = '2026-09-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00461',type ='0', expireDate = '0' , dailyentryId = '864',isService = '0',isOptic = '0',lastbuyprice = '39',lastbuyprice_withDiscount = '39',meanbuyprice = '39',meanbuyprice_withDiscount = '39' , productbuypricereal = '39.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.13' , buyhalf_precentage = '5.13' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='39',meanbuyprice_withTax='39',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='39',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '461';
UPDATE buybilldetail SET  lastbuyprice = 39 , meanbuyprice = 39, lastbuyprice_withDiscount = 39, meanbuyprice_withDiscount = 39
        , lastbuyprice_withTax = 39, meanbuyprice_withTax = 39, lastbuyprice_withDiscountAndTax = 39
                where buybilldetailid = 98;
UPDATE productunit SET proUnitBuyPrice  = 39 * productnumber WHERE productid = 461;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '461';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('461', '1', '20', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '10', '30', '1', '2026-09-26 18:38:31','0','0'); -- id=1940
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00291', '27', '24', '291', '40', '24.8', '992.00', '0', '', '2026-09-26 18:41:12', '291','','','0','0','0','0','0',null,'24.8','992','0','0','0','0','0','0','0','0','1'); -- id=99
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-26 18:38:31', 1, 291, 0, 0
                    , 24.8, 40, 0, 0, 1, '2026-09-26 18:41:17')
                ON DUPLICATE KEY UPDATE buyprice = 24.8,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-26 18:41:17' ; -- id=99
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('291', '24.8', '40', '0', 'buyBillController.php', '99', '', '0', '0'); -- id=99
UPDATE product SET  productBuyPrice = "24.8" WHERE productId = 291 ;
UPDATE buybilldetail SET  quantitybefore = 39 WHERE buybilldetailid = 99 ;
UPDATE product SET productName = 'فيشه دكر ', productDescription = '', productCatId = '24', productBuyPrice = '24.80', productSellAllPrice = '25.80', productSellUnitPrice = '28.00', productSellHalfPrice = '25.80', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00291',type ='0', expireDate = '0' , dailyentryId = '342',isService = '0',isOptic = '0',lastbuyprice = '24.8',lastbuyprice_withDiscount = '24.8',meanbuyprice = '24.8',meanbuyprice_withDiscount = '24.8' , productbuypricereal = '24.80' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.03' , buyhalf_precentage = '4.03' , buypart_precentage = '12.90',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='24.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='24.8',meanbuyprice_withTax='24.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='24.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 = '291';
UPDATE buybilldetail SET  lastbuyprice = 24.8 , meanbuyprice = 24.8, lastbuyprice_withDiscount = 24.8, meanbuyprice_withDiscount = 24.8
        , lastbuyprice_withTax = 24.8, meanbuyprice_withTax = 24.8, lastbuyprice_withDiscountAndTax = 24.8
                where buybilldetailid = 99;
UPDATE productunit SET proUnitBuyPrice  = 24.8 * productnumber WHERE productid = 291;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-26' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '40', '0', '27', 'اضافة فاتورة مشتريات', 'buyBillController.php', '39', '79', '1', '2026-09-26 18:38:31','0','0'); -- id=1941
UPDATE supplier SET  suppliercurrentDebt = '42113.5',suppliercurrentDebtInCurrency= '42113.5' , userid = '1', supplierdate = '2026-09-26 18:41:12'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '42113.50', '0', '0', 'اضافة فاتورة مشتريات', '27', '42113.5', '2026-09-26 18:38:31', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','42113.5','0','42113.5','0',''); -- id=53
UPDATE save SET  savecurrentvalue = '-344942',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-303410.00','41532', '1', '1', 'اضافة فاتورة مشتريات', '27', '-344942', '2026-09-26 18:38:31', '1',  'buyBillController.php','0','','0'); -- id=141
update buybill set dailyentryid='0,0' where buybillid=27;
COMMIT;
UPDATE product SET overAllAveragePrice = 17.6 WHERE productId = 100;UPDATE product SET overAllAveragePrice = 17.6 WHERE productId = 101;UPDATE product SET overAllAveragePrice = 270 WHERE productId = 174;UPDATE product SET overAllAveragePrice = 325 WHERE productId = 175;UPDATE product SET overAllAveragePrice = 24.8 WHERE productId = 291;UPDATE product SET overAllAveragePrice = 39 WHERE productId = 461;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:11:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:41:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 18:41:19', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=27'); -- id=2479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:11:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:41:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:41:28', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2480
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:11:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:41:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:41:49', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2481
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:42:05', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2482
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:42:16', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2483

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =227
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(34,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-09-26 18:42:17', userid = '1' WHERE clientid = '34';
UPDATE client SET  inUse = 0 where clientid = 34;
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 ('34','2850.00','2850','1','ايصال تحصيل (( قبض من عميل ))','227', '0', '2026-09-26 18:42:06', '1', 'clientPayedDeptController.php', '   ', '2850', '0', null, '0', null, null,'', '-1','1','1','2850','1','','18','0','','.'); -- id=227
UPDATE save SET  savecurrentvalue = '-342092',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-344942.00','2850', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '227', '-342092', '2026-09-26 18:42:17', '1',  'clientPayedDeptController.php','34','','0'); -- id=142
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2850', '2850', '2026-09-26', '1', '0', '0', '2026-09-26 18:42:17','اضافة ايصال سداد للعميل محمود شلبي','1','0','0','0','227','clientPayedDeptController.php?do=show&id=227'); -- id=974
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('974', '383', '2850', '','0'); -- id=974
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-247762.97', 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 ('974', '465', '2850', '','0'); -- id=974
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-23 12:12:39' WHERE id = '465';
UPDATE clientdebtchange SET clientid = '34', clientdebtchangebefore = '2850.000', clientdebtchangeamount = '2850.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '227', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-09-26 18:42:06', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2850.000',discount='', reciptid='0', dailyentryid = '974',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='2850',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '227';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:42:18', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2484
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:42:19', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2485
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:42:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2486
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:42:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:42:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2488
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:42:39', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=89'); -- id=2489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:12:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:42:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:42:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2490
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:43:08', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2491

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =228
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(23,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-09-26 18:43:08', userid = '1' WHERE clientid = '23';
UPDATE client SET  inUse = 0 where clientid = 23;
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 ('23','827.01','827.01','1','ايصال تحصيل (( قبض من عميل ))','228', '0', '2026-09-26 18:42:53', '1', 'clientPayedDeptController.php', '   ', '827.01', '0', null, '0', null, null,'', '-1','1','1','827.01','1','','19','0','','.'); -- id=228
UPDATE save SET  savecurrentvalue = '-341264.99',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-342092.00','827.01', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '228', '-341264.99', '2026-09-26 18:43:08', '1',  'clientPayedDeptController.php','23','','0'); -- id=143
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '827.01', '827.01', '2026-09-26', '1', '0', '0', '2026-09-26 18:43:08','اضافة ايصال سداد للعميل محمود احمد','1','0','0','0','228','clientPayedDeptController.php?do=show&id=228'); -- id=975
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('975', '383', '827.01', '','0'); -- id=975
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-246935.96', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('975', '452', '827.01', '','0'); -- id=975
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-21 15:51:30' WHERE id = '452';
UPDATE clientdebtchange SET clientid = '23', clientdebtchangebefore = '827.010', clientdebtchangeamount = '827.010', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '228', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-09-26 18:42:53', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '827.010',discount='', reciptid='0', dailyentryid = '975',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='827.01',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '228';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:43:09', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2492
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-26 18:43:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2493
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-26 18:43:15', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2494
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:43:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2495
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:43:39', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2496
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:43:48', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2497
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:13:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:43:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:43:59', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=73'); -- id=2498
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:14:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:44:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:44:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2499
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:14:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:44:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:44:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2500
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:14:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:44:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:44:23', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=130'); -- id=2501
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:15:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:45:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:45:11', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2502
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 130;
UPDATE sellbill SET  sellbillsysdate = '2026-09-26 18:45:11', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '130';
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 = 921;
 INSERT INTO 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-09-26', 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-09-26', 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 = '280', userid = '1', storedetaildate = '2026-09-26 18:45:11' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '0', '130', 'تعديل فاتورة مبيعات', 'sellbillController.php', '278', '280', '1', '2026-09-26 12:06:36','0','0'); -- id=1942
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 922;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '445', userid = '1', storedetaildate = '2026-09-26 18:45:11' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '0', '130', 'تعديل فاتورة مبيعات', 'sellbillController.php', '435', '445', '1', '2026-09-26 12:06:36','0','0'); -- id=1943
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 923;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.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-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.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 = '128', userid = '1', storedetaildate = '2026-09-26 18:45:12' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '0', '130', 'تعديل فاتورة مبيعات', 'sellbillController.php', '124', '128', '1', '2026-09-26 12:06:36','0','0'); -- id=1944
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '520', userid = '1' WHERE clientid = '18';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('18','723.00','203.00','1','تعديل فاتورة مبيعات','130', '520', '2026-09-26 12:06:36', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '203', '0', null, '0', null, null,'', '0','1','1','203','1','2026-09-26 12:06:36','0','0','',''); -- id=229
UPDATE client SET  inUse = 0 where clientid = 18;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,182.6, 185.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-203, sellCostBuyPrice =sellCostBuyPrice-182.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-182.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-185.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-182.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-185.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-182.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-182.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-185.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-26', 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 182.6, 185.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-203, sellCostBuyPrice =sellCostBuyPrice-182.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-182.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-185.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-182.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-185.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-182.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-182.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-185.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 203, 182.6, 182.6
                    , 185.2, 182.6, 185.2, 182.6, 182.6, 185.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-203, netSellCostBuyPrice = netSellCostBuyPrice-182.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-182.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-185.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-182.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-185.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-182.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-182.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-185.2;

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


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

COMMIT;
BEGIN;
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 12:06:36', '06ab798ee5ed8b', '18', '520.00', '1198', '0', '1', '678', '678', '0', '678', '1', '2026-09-26 12:06:36', '', '1', '0', 'محمد السعيد صالح ', '1', '1', '3', '0', 'محمد السعيد صالح ', '17', '130', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=136
UPDATE client SET  clientdebt = '1198', userid = '1' WHERE clientid = '18';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('18','520.00','678','0','اضافة فاتورة مبيعات (معدله)','136', '1198', '2026-09-26 18:45:13', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '678', '0', null, '0', null, null,'', '0','1','1','203','1','2026-09-26 12:06:36','0','0','',''); -- id=230
UPDATE client SET  inUse = 0 where clientid = 18;
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', '136', '12', '83', '2.00', '45', '90', '0', '', '1', '2026-09-26 18:45:13', '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=943
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 = 943;
 INSERT INTO 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-09-26', 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-09-26', 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 = '278', userid = '1', storedetaildate = '2026-09-26 18:45:13' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '136', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '280', '278', '1', '2026-09-26 18:45:13','0','0'); -- id=1945
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '136', '12', '86', '10.00', '6.5', '65', '0', '', '1', '2026-09-26 18:45:13', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.5','65','0','','0','0.00','0','0','0','0'); -- id=944
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 944;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '435', userid = '1', storedetaildate = '2026-09-26 18:45:13' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '1', '136', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '445', '435', '1', '2026-09-26 18:45:13','0','0'); -- id=1946
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00088', '136', '12', '88', '4.00', '12', '48', '0', '', '1', '2026-09-26 18:45:13', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','48','0','','0','0.00','0','0','0','0'); -- id=945
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 945;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.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+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.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 = '124', userid = '1', storedetaildate = '2026-09-26 18:45:14' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '1', '136', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '128', '124', '1', '2026-09-26 18:45:14','0','0'); -- id=1947
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('415','00073', '136', '12', '73', '1', '475', '475', '0', '', '1', '2026-09-26 18:45:14', '73', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','46-1,','1','1','0','0','475','475','0','','0','0.00','0','0','0','0'); -- id=946
UPDATE sellbilldetail SET  lastbuyprice = 415.00 , meanbuyprice = 407.05, lastbuyprice_withDiscount = 415.00, meanbuyprice_withDiscount = 407.05
        , lastbuyprice_withTax = 415, meanbuyprice_withTax = 407.05, lastbuyprice_withDiscountAndTax = 415
                where sellbilldetailid = 946;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-26', 475, 415, 415
                    , 407.05, 415, 407.05, 415
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 415, 407.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+415
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+415, sellCostMeanBuyPrice = sellCostMeanBuyPrice+407.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+415, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+407.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+415
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+415
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+407.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 475, 415, 415
                    , 407.05, 415, 407.05, 415
                    , 0, 0, 0, 0
                    , 0, 0, 0, 415, 407.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+415
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+415, sellCostMeanBuyPrice = sellCostMeanBuyPrice+407.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+415, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+407.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+415
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+415
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+407.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-09-26 18:45:14' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '1', '136', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '19', '18', '1', '2026-09-26 18:45:14','0','0'); -- id=1948
UPDATE dailyentry SET totalcreditor = '203.00', totaldebtor = '203.00', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 12:06:38', entryComment = 'اضافة فاتورة مبيعات رقم 130', fromFlag = '1',related='0',isopeningentry='0',operationId='130',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=130' WHERE id = '952';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '203.00', '203.00', '2026-09-26', '1', '0', '952', '2026-09-26 18:45:14','تم عكس القيد رقم 952 ','1','0','0','0','0',''); -- id=976
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('976', '447', '203.00', '','0'); -- id=976
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '520', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('976', '143', '203.00', '','0'); -- id=976
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458306.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '182.60', totaldebtor = '182.60', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 12:06:38', entryComment = 'اضافة فاتورة مبيعات رقم 130 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='130',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=130' WHERE id = '953';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '182.60', '182.60', '2026-09-26', '1', '0', '953', '2026-09-26 18:45:15','تم عكس القيد رقم 953 ','1','0','0','0','0',''); -- id=977
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('977', '402', '182.60', '','0'); -- id=977
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '425344.53', 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 ('977', '382', '182.60', '','0'); -- id=977
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2416858.94', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '678', '678', '2026-09-26', '1', '0', '0', '2026-09-26 18:45:15','اضافة فاتورة مبيعات رقم 136','1','0',null,'0','136','sellbillController.php?do=showDetail&sellbillid=136'); -- id=978
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('978', '447', '678', '','0'); -- id=978
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '1198', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('978', '143', '678', '','0'); -- id=978
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458984.8', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '597.6', '597.6', '2026-09-26', '1', '0', '0', '2026-09-26 18:45:15','اضافة فاتورة مبيعات رقم 136 - صرف البضاعة من المخزن','1','0',null,'0','136','sellbillController.php?do=showDetail&sellbillid=136'); -- id=979
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('979', '402', '597.6', '','0'); -- id=979
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '425942.13', 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 ('979', '382', '597.6', '','0'); -- id=979
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2416261.34', 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='978,0,979' where sellbillid=136;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 678, 597.6, 597.6
                    , 592.25, 597.6, 592.25, 597.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,597.6, 592.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+678, sellCostBuyPrice =sellCostBuyPrice+597.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+597.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+592.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+597.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+592.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+597.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+597.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+592.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-26', 678, 597.6, 597.6
                    , 592.25, 597.6, 592.25, 597.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,597.6, 592.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+678, sellCostBuyPrice =sellCostBuyPrice+597.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+597.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+592.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+597.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+592.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+597.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+597.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+592.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 678, 597.6, 597.6
                    , 592.25, 597.6, 592.25, 597.6, 597.6, 592.25)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+678, netSellCostBuyPrice = netSellCostBuyPrice+597.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+597.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+592.25
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+597.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+592.25
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+597.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+597.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+592.25;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 130 and newid=136 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:15:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:45:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:45:17', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=136'); -- id=2503
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:16:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:46:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-09-26 18:46:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientController.php?do=show'); -- id=2504
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:16:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:46:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-26 18:46:39', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?clientid=3&find=month'); -- id=2505
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 15:18:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 18:48:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 18:48:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2506
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:16:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:46:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 19:46:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2507
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:16:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:46:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-26 19:46:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=2508
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:25:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:55:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 19:55:17', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2509

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab804f078398
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 19:55:18', '06ab804f078398', '1', '0.00', '0', '0', '1', '14960.25', '14960.25', '14960.25', '0', '1', '2026-09-26 19:55:18', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '307' ,'0','','','','','-1','0','0','0','0','0','14960','0','','0','0','14960.25','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=137
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','اضافة فاتورة مبيعات','137', '0', '2026-09-26 19:55:18', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14960.25', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 19:55:18','0','0','',''); -- id=231
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '137', '1', '41', '90', '45.5', '4095', '0', '', '1', '2026-09-26 19:55:19', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45.5','4095','0','','0','0.00','0','0','0','0'); -- id=947
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 947;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-09-26', 4095, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4095, sellCostBuyPrice =sellCostBuyPrice+3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3989.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+90
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 4095, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4095, sellCostBuyPrice =sellCostBuyPrice+3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3989.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '385', userid = '1', storedetaildate = '2026-09-26 19:55:19' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '90', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '475', '385', '1', '2026-09-26 19:55:19','0','0'); -- id=1949
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '137', '1', '42', '90', '30.35', '2731.5', '0', '', '1', '2026-09-26 19:55:19', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.35','2731.5','0','','0','0.00','0','0','0','0'); -- id=948
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 948;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-09-26', 2731.5, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2731.5, sellCostBuyPrice =sellCostBuyPrice+2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+90
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 2731.5, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2731.5, sellCostBuyPrice =sellCostBuyPrice+2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '704', userid = '1', storedetaildate = '2026-09-26 19:55:19' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '90', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '794', '704', '1', '2026-09-26 19:55:19','0','0'); -- id=1950
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '137', '1', '43', '75', '30.35', '2276.25', '0', '', '1', '2026-09-26 19:55:19', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.35','2276.25','0','','0','0.00','0','0','0','0'); -- id=949
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 949;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-09-26', 2276.25, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2276.25, sellCostBuyPrice =sellCostBuyPrice+2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2212.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 2276.25, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2276.25, sellCostBuyPrice =sellCostBuyPrice+2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2212.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '621', userid = '1', storedetaildate = '2026-09-26 19:55:19' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '75', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '696', '621', '1', '2026-09-26 19:55:19','0','0'); -- id=1951
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('191','00376', '137', '1', '376', '8', '205', '1640', '0', '', '1', '2026-09-26 19:55:20', '376', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','205','1640','0','','0','0.00','0','0','0','0'); -- id=950
UPDATE sellbilldetail SET  lastbuyprice = 191.00 , meanbuyprice = 191.00, lastbuyprice_withDiscount = 191.00, meanbuyprice_withDiscount = 191.00
        , lastbuyprice_withTax = 191, meanbuyprice_withTax = 191, lastbuyprice_withDiscountAndTax = 191
                where sellbilldetailid = 950;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (376, '2026-09-26', 1640, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1640, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-26 19:55:20' WHERE storedetailid = '376';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '1', '8', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '0', '1', '2026-09-26 19:55:20','0','0'); -- id=1952
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('137.25','00050', '137', '1', '50', '5', '141', '705', '0', '', '1', '2026-09-26 19:55:20', '50', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','141','705','0','','0','0.00','0','0','0','0'); -- id=951
UPDATE sellbilldetail SET  lastbuyprice = 137.25 , meanbuyprice = 137.25, lastbuyprice_withDiscount = 137.25, meanbuyprice_withDiscount = 137.25
        , lastbuyprice_withTax = 137.25, meanbuyprice_withTax = 137.25, lastbuyprice_withDiscountAndTax = 137.25
                where sellbilldetailid = 951;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (50, '2026-09-26', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+686.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+686.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-26 19:55:20' WHERE storedetailid = '50';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '1', '5', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '61', '1', '2026-09-26 19:55:20','0','0'); -- id=1953
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00048', '137', '1', '48', '3', '54.5', '163.5', '0', '', '1', '2026-09-26 19:55:20', '48', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.5','163.5','0','','0','0.00','0','0','0','0'); -- id=952
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 952;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-09-26', 163.5, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+163.5, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 163.5, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+163.5, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '117', userid = '1', storedetaildate = '2026-09-26 19:55:21' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '3', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '117', '1', '2026-09-26 19:55:21','0','0'); -- id=1954
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('254','00314', '137', '1', '314', '3', '261', '783', '0', '', '1', '2026-09-26 19:55:21', '314', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','261','783','0','','0','0.00','0','0','0','0'); -- id=953
UPDATE sellbilldetail SET  lastbuyprice = 254.00 , meanbuyprice = 254.00, lastbuyprice_withDiscount = 254.00, meanbuyprice_withDiscount = 254.00
        , lastbuyprice_withTax = 254, meanbuyprice_withTax = 254, lastbuyprice_withDiscountAndTax = 254
                where sellbilldetailid = 953;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (314, '2026-09-26', 783, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+783, sellCostBuyPrice =sellCostBuyPrice+762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 783, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+783, sellCostBuyPrice =sellCostBuyPrice+762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-26 19:55:21' WHERE storedetailid = '314';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('314', '1', '3', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '1', '2026-09-26 19:55:21','0','0'); -- id=1955
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50.67','00053', '137', '1', '53', '6', '53', '318', '0', '', '1', '2026-09-26 19:55:21', '53', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','53','318','0','','0','0.00','0','0','0','0'); -- id=954
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 954;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-09-26', 318, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+318, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 318, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+318, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '71', userid = '1', storedetaildate = '2026-09-26 19:55:21' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '77', '71', '1', '2026-09-26 19:55:21','0','0'); -- id=1956
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('100.3','00049', '137', '1', '49', '2', '104', '208', '0', '', '1', '2026-09-26 19:55:21', '49', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','104','208','0','','0','0.00','0','0','0','0'); -- id=955
UPDATE sellbilldetail SET  lastbuyprice = 100.30 , meanbuyprice = 100.30, lastbuyprice_withDiscount = 100.30, meanbuyprice_withDiscount = 100.30
        , lastbuyprice_withTax = 100.3, meanbuyprice_withTax = 100.3, lastbuyprice_withDiscountAndTax = 100.3
                where sellbilldetailid = 955;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (49, '2026-09-26', 208, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+208, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 208, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+208, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-2', userid = '1', storedetaildate = '2026-09-26 19:55:22' WHERE storedetailid = '49';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '1', '2', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-2', '1', '2026-09-26 19:55:22','0','0'); -- id=1957
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00046', '137', '1', '46', '10', '92.5', '925', '0', '', '1', '2026-09-26 19:55:22', '46', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','92.5','925','0','','0','0.00','0','0','0','0'); -- id=956
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 956;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-09-26', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '85', userid = '1', storedetaildate = '2026-09-26 19:55:22' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '10', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '95', '85', '1', '2026-09-26 19:55:22','0','0'); -- id=1958
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '137', '1', '47', '10', '92.5', '925', '0', '', '1', '2026-09-26 19:55:22', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','92.5','925','0','','0','0.00','0','0','0','0'); -- id=957
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 957;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-09-26', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '94', userid = '1', storedetaildate = '2026-09-26 19:55:22' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '10', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '104', '94', '1', '2026-09-26 19:55:22','0','0'); -- id=1959
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('36.95','00051', '137', '1', '51', '5', '38', '190', '0', '', '1', '2026-09-26 19:55:22', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','38','190','0','','0','0.00','0','0','0','0'); -- id=958
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 958;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-09-26', 190, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 190, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '81', userid = '1', storedetaildate = '2026-09-26 19:55:23' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '1', '137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '86', '81', '1', '2026-09-26 19:55:23','0','0'); -- id=1960
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-326304.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 ('-341265','14960.25', '0', '1', 'اضافة فاتورة مبيعات', '137', '-326304.75', '2026-09-26 19:55:23', '1',  'sellbillController.php','1','','0'); -- id=144
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14960.25', '14960.25', '2026-09-26', '1', '0', '0', '2026-09-26 19:55:23','اضافة فاتورة مبيعات رقم 137','1','0',null,'0','137','sellbillController.php?do=showDetail&sellbillid=137'); -- id=980
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('980', '383', '14960.25', '','0'); -- id=980
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-231975.71', 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 ('980', '143', '14960.25', '','0'); -- id=980
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '473945.05', 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 ( '14475.19', '14475.19', '2026-09-26', '1', '0', '0', '2026-09-26 19:55:23','اضافة فاتورة مبيعات رقم 137 - صرف البضاعة من المخزن','1','0',null,'0','137','sellbillController.php?do=showDetail&sellbillid=137'); -- id=981
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('981', '402', '14475.19', '','0'); -- id=981
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '440417.32', 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 ('981', '382', '14475.19', '','0'); -- id=981
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2401786.15', 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='980,0,981' where sellbillid=137;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14475.19, 14475.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14960.25, sellCostBuyPrice =sellCostBuyPrice+14475.19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14475.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14475.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14475.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14475.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14475.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14475.19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14475.19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14475.19, 14475.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14960.25, sellCostBuyPrice =sellCostBuyPrice+14475.19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14475.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14475.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14475.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14475.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14475.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14475.19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14475.19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19, 14475.19, 14475.19)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14960.25, netSellCostBuyPrice = netSellCostBuyPrice+14475.19
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14475.19
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14475.19
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14475.19
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14475.19
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14475.19
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14475.19
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14475.19;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab804f078398 and sellbillId = 137 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:25:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:55:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 19:55:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2510
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:25:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:55:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-26 19:55:43', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=2511
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:25:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:55:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-26 19:55:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=2512
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:26:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 19:56:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 19:56:02', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2513
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:57:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 20:27:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 20:27:13', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2514

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab8070db2470
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 20:27:14', '06ab8070db2470', '1', '0.00', '0', '0', '1', '1648.00', '1648', '1648', '0', '1', '2026-09-26 20:27:14', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','1648','0','','0','0','1648','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-26','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=138
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','اضافة فاتورة مبيعات','138', '0', '2026-09-26 20:27:14', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1648', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 20:27:14','0','0','',''); -- id=232
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '138', '12', '82', '2', '34', '68', '0', '', '0', '2026-09-26 20:27:15', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-2,','1','1','0','0','34','68','0','','0','','0','0','0','0'); -- id=959
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 = 959;
 INSERT INTO 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-09-26', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+61.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+61.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 = '343', userid = '1', storedetaildate = '2026-09-26 20:27:15' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '138', 'اضافة فاتورة مبيعات', 'sellbillController.php', '345', '343', '1', '2026-09-26 20:27:15','0','0'); -- id=1961
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('730','00249', '138', '10', '249', '2', '790', '1580', '0', '', '0', '2026-09-26 20:27:15', '249', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','790','1580','0','','0','','0','0','0','0'); -- id=960
UPDATE sellbilldetail SET  lastbuyprice = 730.00 , meanbuyprice = 730.00, lastbuyprice_withDiscount = 730.00, meanbuyprice_withDiscount = 730.00
        , lastbuyprice_withTax = 730, meanbuyprice_withTax = 730, lastbuyprice_withDiscountAndTax = 730
                where sellbilldetailid = 960;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (249, '2026-09-26', 1580, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1580, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1580, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1580, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-09-26 20:27:15' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '2', '1', '138', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '9', '1', '2026-09-26 20:27:15','0','0'); -- id=1962
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-324656.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 ('-326304.75','1648', '0', '1', 'اضافة فاتورة مبيعات', '138', '-324656.75', '2026-09-26 20:27:15', '1',  'sellbillController.php','1','','0'); -- id=145
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1648', '1648', '2026-09-26', '1', '0', '0', '2026-09-26 20:27:15','اضافة فاتورة مبيعات رقم 138','1','0',null,'0','138','sellbillController.php?do=showDetail&sellbillid=138'); -- id=982
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('982', '383', '1648', '','0'); -- id=982
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-230327.71', 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 ('982', '143', '1648', '','0'); -- id=982
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '475593.05', 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 ( '1521.6', '1521.6', '2026-09-26', '1', '0', '0', '2026-09-26 20:27:15','اضافة فاتورة مبيعات رقم 138 - صرف البضاعة من المخزن','1','0',null,'0','138','sellbillController.php?do=showDetail&sellbillid=138'); -- id=983
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('983', '402', '1521.6', '','0'); -- id=983
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '441938.92', 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 ('983', '382', '1521.6', '','0'); -- id=983
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2400264.55', 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='982,0,983' where sellbillid=138;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 1648, 1521.6, 1521.6
                    , 1521.6, 1521.6, 1521.6, 1521.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1521.6, 1521.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1648, sellCostBuyPrice =sellCostBuyPrice+1521.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1521.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1521.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1521.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1521.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1521.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1521.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1521.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 1648, 1521.6, 1521.6
                    , 1521.6, 1521.6, 1521.6, 1521.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1521.6, 1521.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1648, sellCostBuyPrice =sellCostBuyPrice+1521.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1521.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1521.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1521.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1521.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1521.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1521.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1521.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1648, 1521.6, 1521.6
                    , 1521.6, 1521.6, 1521.6, 1521.6, 1521.6, 1521.6)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1648, netSellCostBuyPrice = netSellCostBuyPrice+1521.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1521.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1521.6
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1521.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1521.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1521.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1521.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1521.6;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab8070db2470 and sellbillId = 138 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 16:57:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 20:27:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 20:27:17', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2515
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 17:41:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:11:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 21:11:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2516
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 17:43:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:13:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 21:13:33', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2517

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab818f8b337b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(13,@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-09-26 21:13:33', '06ab818f8b337b', '13', '17572.40', '15142.4', '0', '1', '2430', '2430', '0', '-2430', '1', '2026-09-26 21:13:33', '', '1', '0', 'ابراهيم صلاح ','1', '1', '5', '0', '13 - ابراهيم صلاح ', '55', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=9
UPDATE client SET  clientdebt = '15142.4', userid = '1' WHERE clientid = '13';
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 ('13','17572.40','2430','1','اضافة فاتورة مردوات مبيعات','9', '15142.4', '2026-09-26 21:13:34', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '2430', '0', null, '0', null, null,'', '0','1','1','2430','1','2026-09-26 21:13:33','0','0','',''); -- id=233
UPDATE client SET  inUse = 0 where clientid = 13;
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 ('730.00', '00249', '9', '10', '249', '1', '810', '810', '0', '', '1', '0', '249', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','810','810','0','','0'); -- id=22
UPDATE returnsellbilldetail SET  lastbuyprice = 730.00 , meanbuyprice = 730.00, lastbuyprice_withDiscount = 730.00, meanbuyprice_withDiscount = 730.00
        , lastbuyprice_withTax = 730, meanbuyprice_withTax = 730, lastbuyprice_withDiscountAndTax = 730
                where returnsellbilldetailid = 22;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (249, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 810, 730, 730, 730
                    , 730, 730, 730, 0, 1, 0, 0, 730, 730)
                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+810, returnSellCostBuyPrice = returnSellCostBuyPrice+730, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+730
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+730, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+730
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+730
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+730
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+730
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+730
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 810, 730, 730, 730
                    , 730, 730, 730, 0, 0, 730, 730)
                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+810, returnSellCostBuyPrice = returnSellCostBuyPrice+730, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+730
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+730, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+730
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+730
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+730
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+730
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+730;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-26 21:13:34' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '1', '0', '9', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '9', '10', '1', '2026-09-26 21:13:34','0','0'); -- id=1963
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 ('26.50', '00235', '9', '10', '235', '54', '30', '1620', '0', '', '1', '0', '235', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','30','1620','0','','0'); -- id=23
UPDATE returnsellbilldetail SET  lastbuyprice = 26.50 , meanbuyprice = 26.50, lastbuyprice_withDiscount = 26.50, meanbuyprice_withDiscount = 26.50
        , lastbuyprice_withTax = 26.5, meanbuyprice_withTax = 26.5, lastbuyprice_withDiscountAndTax = 26.5
                where returnsellbilldetailid = 23;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (235, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1620, 1431, 1431, 1431
                    , 1431, 1431, 1431, 0, 54, 0, 0, 1431, 1431)
                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+1620, returnSellCostBuyPrice = returnSellCostBuyPrice+1431, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1431
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1431, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1431
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1431
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1431
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1431
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1431
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+54;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1620, 1431, 1431, 1431
                    , 1431, 1431, 1431, 0, 0, 1431, 1431)
                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+1620, returnSellCostBuyPrice = returnSellCostBuyPrice+1431, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1431
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1431, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1431
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1431
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1431
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1431
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1431;
UPDATE storedetail SET  productquantity = '154', userid = '1', storedetaildate = '2026-09-26 21:13:35' WHERE storedetailid = '235';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('235', '1', '54', '0', '9', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '100', '154', '1', '2026-09-26 21:13:35','0','0'); -- id=1964
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2430', '2430', '2026-09-26', '1', '0', '0', '2026-09-26 21:13:35','اضافة فاتورة مردود مبيعات رقم 9','1','0',null,'0','9','returnsellbillController.php?do=showDetail&returnsellbillid=9'); -- id=984
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('984', '143', '2430', '','0'); -- id=984
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '473163.05', 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 ('984', '441', '2430', '','0'); -- id=984
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '15142.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2161', '2161', '2026-09-26', '1', '0', '0', '2026-09-26 21:13:35','اضافة فاتورة مردود مبيعات رقم 9 - صرف البضاعة من المخزن','1','0',null,'0','9','returnsellbillController.php?do=showDetail&returnsellbillid=9'); -- id=985
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('985', '382', '2161', '','0'); -- id=985
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2402425.55', 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 ('985', '402', '2161', '','0'); -- id=985
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '439777.92', 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='984,0,985' where returnsellbillid=9;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2430, 2161, 2161, 2161
                    , 2161, 2161, 2161 ,0, 0, 2161, 2161)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2430, returnSellCostBuyPrice = returnSellCostBuyPrice+2161, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2161
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2161, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2161
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2161
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2161
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2161
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2161;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-09-26', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2430, 2161, 2161, 2161
                    , 2161, 2161, 2161 ,0, 0, 2161, 2161)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2430, returnSellCostBuyPrice = returnSellCostBuyPrice+2161, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2161
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2161, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2161
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2161
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2161
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2161
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2161;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -2430, -2161, -2161
                    , -2161, -2161, -2161, -2161, -2161, -2161)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-2430, netSellCostBuyPrice = netSellCostBuyPrice+-2161
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-2161
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-2161
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-2161
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-2161
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-2161
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-2161
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-2161;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab818f8b337b and sellbillId = 9 and returnsellbillId = 9
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 17:43:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:13:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 21:13:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2518
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 17:43:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:13:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-26 21:13:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2519
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 17:43:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:13:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-26 21:13:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2520
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 18:11:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 21:41:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-26 21:41:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2521
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-26 19:16:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-26 22:46:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-26 22:46:24', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2522
